Flag-Enum implementiert und IServiceMessage mit Flag-Unterstützung aktualisiert

- Flag-Enum mit Null und SecurityBreach definiert.
- Flag-Eigenschaft und HasFlag-Methode zu IServiceMessage hinzugefügt.
This commit is contained in:
Developer 02 2024-04-22 10:21:39 +02:00
parent fae750c1d8
commit 4dea6b9b00
34 changed files with 51 additions and 2 deletions

Binary file not shown.

View File

@ -0,0 +1,19 @@
namespace DigitalData.Core.Application
{
/// <summary>
/// Defines flags that indicate specific types of status or conditions in a service operation.
/// These flags help in categorizing and identifying specific circumstances or issues that may arise during execution.
/// </summary>
public enum Flag
{
/// <summary>
/// Indicates that no specific condition or status is associated with the service operation.
/// </summary>
Null,
/// <summary>
/// Indicates a security breach or vulnerability has been detected during the service operation.
/// </summary>
SecurityBreach
}
}

View File

@ -46,6 +46,21 @@ namespace DigitalData.Core.Application
/// </summary>
public bool IsSuccess { get; set; } = false;
/// <summary>
/// Gets or sets the flag that indicates the specific status type of the service operation.
/// This flag helps in categorizing the state of the operation more granularly.
/// </summary>
[JsonIgnore]
public Enum Flag { get; set; } = Application.Flag.Null;
/// <summary>
/// Checks if the current service message's flag matches the specified flag.
/// This method is useful for conditional logic based on the status of the operation.
/// </summary>
/// <param name="flag">The flag to check against the current service message's flag.</param>
/// <returns>true if the flags match; otherwise, false.</returns>
public bool HasFlag(Enum flag) => Flag.ToString() == flag.ToString();
/// <summary>
/// [Obsolete("Deprecated: Use ClientMessages instead.")]
/// Gets a collection of messages associated with the service operation. These messages can be error descriptions,

View File

@ -1 +1 @@
1204f54a36145ece1945026f8fb6c0371ee8b734
cab2f6eb8a1a8332777e30db94aff8080085a4c2

View File

@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
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.
@ -14,6 +14,21 @@ namespace DigitalData.Core.Contracts.Application
/// </summary>
bool IsSuccess { get; set; }
/// <summary>
/// Gets or sets the flag that indicates the specific status type of the service operation.
/// This flag helps in categorizing the state of the operation more granularly.
/// </summary>
[JsonIgnore]
Enum Flag { get; set; }
/// <summary>
/// Checks if the current service message's flag matches the specified flag.
/// This method is useful for conditional logic based on the status of the operation.
/// </summary>
/// <param name="flag">The flag to check against the current service message's flag.</param>
/// <returns>true if the flags match; otherwise, false.</returns>
public bool HasFlag(Enum flag) => Flag.ToString() == flag.ToString();
/// <summary>
/// [Obsolete("Deprecated: Use ClientMessages instead.")]
/// Gets a collection of messages associated with the service operation. These messages can be error descriptions,