WebCommunicationModels 0.0.2

dotnet add package WebCommunicationModels --version 0.0.2
                    
NuGet\Install-Package WebCommunicationModels -Version 0.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WebCommunicationModels" Version="0.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebCommunicationModels" Version="0.0.2" />
                    
Directory.Packages.props
<PackageReference Include="WebCommunicationModels" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WebCommunicationModels --version 0.0.2
                    
#r "nuget: WebCommunicationModels, 0.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WebCommunicationModels@0.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WebCommunicationModels&version=0.0.2
                    
Install as a Cake Addin
#tool nuget:?package=WebCommunicationModels&version=0.0.2
                    
Install as a Cake Tool

WebCommunicationModels

Eine einfache .NET Standard 2.1 Klassenbibliothek mit wiederverwendbaren Datenmodellen für Web-Kommunikation.

Übersicht

Dieses Projekt bietet standardisierte Modelle für die Kommunikation zwischen Web-APIs und Clients. Die Modelle ermöglichen eine konsistente Struktur für API-Antworten, Pagination, Benachrichtigungen und Dateiverarbeitung.

Modelle

ApiResponse<T>

Standardisierte API-Antwortstruktur mit generischem Datentyp.

Eigenschaften:

  • Status: Antwortstatus ("success", "fail", "error", "forbidden")
  • Data: Generische Daten vom Typ T
  • Message: Beschreibung der Antwort
  • Notifications: Liste von Benachrichtigungen

Hilfsmethoden:

  • Success(data, message): Erstellt erfolgreiche Antwort
  • Fail(data, message): Erstellt Fehler-Antwort
  • Error(data, message): Erstellt Error-Antwort
  • Forbidden(data, message): Erstellt Verboten-Antwort

Notification

Benachrichtigungsmodell für Client-Nachrichten.

Eigenschaften:

  • Severity: Art der Benachrichtigung ("success", "info", "warning", "error")
  • Message: Benachrichtigungstext
  • Title: Titel (optional)
  • Variables: Zusätzliche Variablen (optional)

Hilfsmethoden:

  • Success(message, title, variables)
  • Info(message, title, variables)
  • Warning(message, title, variables)
  • Error(message, title, variables)

FileModel

Modell für Datei-Upload und -Download mit Base64-Unterstützung.

Eigenschaften:

  • Content: Binärer Dateiinhalt (byte[])
  • Base64EncodedContent: Base64-kodierter Dateiinhalt (string)
  • Name: Dateiname
  • ContentType: MIME-Type (z.B. "application/pdf")

Methoden:

  • ToBase64(): Konvertiert Binär zu Base64 (löscht Original)
  • FromBase64(): Konvertiert Base64 zu Binär (löscht Base64)

Paging

Parameter für Datenpagination.

Eigenschaften:

  • Filter: Suchfilter (Standard: "")
  • Skip: Übersprungene Datensätze (Standard: 0)
  • Take: Anzahl abzurufender Datensätze (Standard: 10)

PaginationResponse<T>

Antwort mit paginierten Daten.

Eigenschaften:

  • Total: Gesamtanzahl der Datensätze
  • Items: Abgerufene Datensätze

Anforderungen

  • .NET Standard 2.1 oder höher
  • C# 8.0 oder höher

Verwendungsbeispiel

// Beispiel für die Verwendung von ApiResponse
var response = ApiResponse<string>.Success("Daten erfolgreich geladen", "Die Anfrage war erfolgreich");

// Beispiel für die Verwendung von Notification
var notification = Notification.Success("Die Datei wurde hochgeladen", "Hochladen erfolgreich");

// Beispiel für die Verwendung von FileModel
var fileModel = new FileModel
{
    Name = "beispiel.pdf",
    ContentType = "application/pdf"
};
fileModel.FromBase64("JVBERi0xLjQKJaqrrw0K..."); // Base64 string gekürzt
var base64String = fileModel.ToBase64();

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.2 162 1/13/2026
0.0.1 96 1/12/2026