Funktion: Erweiterung von IServiceMessage mit Methoden zur Nachrichtenverwaltung
- Hinzufügen von Erweiterungsmethoden zu IServiceMessage für das Hinzufügen von Client-, Trace-, Debug-, Informations-, Warn-, Fehler- und kritischen Nachrichten. - Einbeziehung von Methoden für direkte Nachrichten und auf Enum basierende Schlüssel, die Lokalisierung und benutzerdefinierte Formatierung unterstützen.
This commit is contained in:
@@ -5,62 +5,70 @@ namespace DigitalData.Core.Contracts.Application
|
||||
/// <summary>
|
||||
/// Defines a structured format for service messages, categorizing them into success indicators and various types of messages.
|
||||
/// This interface segregates messages into client-facing messages and different levels of logging messages, facilitating targeted communications and diagnostics.
|
||||
/// Properties are initialized once per instance and cannot be modified afterwards, promoting immutability.
|
||||
/// </summary>
|
||||
public interface IServiceMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a flag indicating whether the service operation was successful.
|
||||
/// Gets or sets a value indicating whether the service operation was successful.
|
||||
/// </summary>
|
||||
bool IsSuccess { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection of messages intended for client display. This is intended to replace the deprecated 'Messages' property.
|
||||
/// </summary>
|
||||
List<string> ClientMessages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [Obsolete("Deprecated: Use ClientMessages instead.")]
|
||||
/// Gets or sets a collection of messages associated with the service operation. These messages can be error descriptions,
|
||||
/// Gets a collection of messages associated with the service operation. These messages can be error descriptions,
|
||||
/// success notifications, or other relevant information related to the operation's outcome.
|
||||
/// </summary>
|
||||
[Obsolete("Deprecated: Use ClientMessages instead.")]
|
||||
List<string> Messages { get; set; }
|
||||
List<string> Messages { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection of messages used for tracing program execution at a fine-grained level. These are typically voluminous and detailed.
|
||||
/// Gets a collection of messages intended for client display. This replaces the deprecated 'Messages' property.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
List<string> TraceMessages { get; set; }
|
||||
List<string> ClientMessages { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection of messages helpful for debugging during development. These messages are often diagnostic.
|
||||
/// Gets a collection of messages used for tracing program execution at a fine-grained level. These are typically voluminous and detailed.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
List<string> DebugMessages { get; set; }
|
||||
List<string> TraceMessages { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection of informational messages, less critical than warnings, generally used for non-critical notifications.
|
||||
/// Gets a collection of messages helpful for debugging during development. These messages are often diagnostic.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
List<string> InformationMessages { get; set; }
|
||||
List<string> DebugMessages { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection of messages indicating potential issues that are not necessarily errors, but which may require attention.
|
||||
/// Gets a collection of informational messages, less critical than warnings, generally used for non-critical notifications.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
List<string> WarningMessages { get; set; }
|
||||
List<string> InformationMessages { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection of error messages indicating failures or problems within the service.
|
||||
/// Gets a collection of messages indicating potential issues that are not necessarily errors, but which may require attention.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
List<string> ErrorMessages { get; set; }
|
||||
List<string> WarningMessages { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection of messages indicating critical issues that require immediate attention.
|
||||
/// Gets a collection of error messages indicating failures or problems within the service.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
List<string> CriticalMessages { get; set; }
|
||||
List<string> ErrorMessages { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of messages indicating critical issues that require immediate attention.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
List<string> CriticalMessages { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// A function that translates a message key from a string to its localized or transformed representation.
|
||||
/// This property allows for custom translation logic to be applied based on the application's needs.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public Func<string, string> KeyTranslator { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new message to the appropriate collection based on the message type.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user