Überarbeiten Sie die Methoden zur Handhabung von Service-Nachrichtenflags, stellen Sie sicher, dass sie ordnungsgemäß in ICollection konvertiert werden, und verbessern Sie die Klarheit.
This commit is contained in:
@@ -47,19 +47,19 @@ namespace DigitalData.Core.Application
|
||||
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.
|
||||
/// Represents the list of flags that indicate specific types of statuses or conditions in a service operation.
|
||||
/// These flags help in categorizing the state of the operation more granularly, allowing for multiple conditions to be represented simultaneously.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public Enum? Flag { get; set; } = default;
|
||||
public ICollection<Enum> Flags { get; } = new List<Enum>();
|
||||
|
||||
/// <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.
|
||||
/// Checks if any of the current service message's flags matches the specified flag based on their string representations.
|
||||
/// This method is useful for conditional logic where the exact string representation of the flag values is crucial.
|
||||
/// </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();
|
||||
/// <param name="flag">The flag to check against the current service message's flags.</param>
|
||||
/// <returns>true if a flag with a matching string representation exists; otherwise, false.</returns>
|
||||
public bool HasFlag(Enum flag) => Flags.Any(f => f.ToString() == flag.ToString());
|
||||
|
||||
/// <summary>
|
||||
/// [Obsolete("Deprecated: Use ClientMessages instead.")]
|
||||
|
||||
@@ -10,40 +10,45 @@ namespace DigitalData.Core.Application
|
||||
/// </summary>
|
||||
public static class ServiceMessageExtensions
|
||||
{
|
||||
#region Flag
|
||||
/// <summary>
|
||||
/// Sets the specified flag on the service message or result, allowing for the categorization of the message based on specific conditions or statuses.
|
||||
/// Sets the specified flag on the service message, allowing for detailed categorization of the message based on specific conditions or statuses.
|
||||
/// This method supports fluent chaining by returning the modified service message instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of IServiceMessage.</typeparam>
|
||||
/// <param name="serviceMessage">The service message instance to modify.</param>
|
||||
/// <param name="flag">The flag to set, indicating a specific condition or status.</param>
|
||||
/// <returns>The service message instance with the updated flag, facilitating fluent chaining of methods.</returns>
|
||||
/// <returns>The modified service message instance, facilitating fluent chaining of methods.</returns>
|
||||
public static T WithFlag<T>(this T serviceMessage, Enum flag) where T : IServiceMessage
|
||||
{
|
||||
serviceMessage.Flag = flag;
|
||||
serviceMessage.Flags.Add(flag);
|
||||
return serviceMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the service message has a flag indicating a security breach.
|
||||
/// Checks if the service message has a flag indicating a security breach.
|
||||
/// This is useful for identifying messages related to security concerns for prompt and specific handling.
|
||||
/// </summary>
|
||||
/// <param name="serviceMessage">The service message instance to check.</param>
|
||||
/// <returns>True if the service message has the security breach flag; otherwise, false.</returns>
|
||||
/// <returns>True if the service message contains the security breach flag; otherwise, false.</returns>
|
||||
public static bool HasSecurityBreachFlag(this IServiceMessage serviceMessage) => serviceMessage.HasFlag(Flag.SecurityBreach);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the service message has a flag indicating a data integrity issue.
|
||||
/// Checks if the service message has a flag indicating a data integrity issue.
|
||||
/// This method is essential for operations where data accuracy and integrity are critical.
|
||||
/// </summary>
|
||||
/// <param name="serviceMessage">The service message instance to check.</param>
|
||||
/// <returns>True if the service message has the data integrity issue flag; otherwise, false.</returns>
|
||||
/// <returns>True if the service message contains the data integrity issue flag; otherwise, false.</returns>
|
||||
public static bool HasDataIntegrityIssueFlag(this IServiceMessage serviceMessage) => serviceMessage.HasFlag(Flag.DataIntegrityIssue);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the service message has a flag indicating either a security breach or a data integrity issue, or both.
|
||||
/// This flag is used when it is not sure whether the problem is security or data integrity. In this case, data integrity should be checked first.
|
||||
/// Checks if the service message has a flag indicating either a security breach or a data integrity issue, or both.
|
||||
/// This flag is critical when it is uncertain whether the problem pertains to security or data integrity, advising that data integrity checks should be prioritized.
|
||||
/// </summary>
|
||||
/// <param name="serviceMessage">The service message instance to check.</param>
|
||||
/// <returns>True if the service message has the flag indicating either or both issues; otherwise, false.</returns>
|
||||
/// <returns>True if the service message contains the flag for either or both issues; otherwise, false.</returns>
|
||||
public static bool HasSecurityBreachOrDataIntegrityFlag(this IServiceMessage serviceMessage) => serviceMessage.HasFlag(Flag.SecurityBreachOrDataIntegrity);
|
||||
#endregion
|
||||
|
||||
#region ClientMessage
|
||||
/// <summary>
|
||||
|
||||
Binary file not shown.
@@ -45,3 +45,18 @@ E:\TekH\Visual Studio\DDWeb\WebCoreModules\DigitalData.Core.Application\obj\Debu
|
||||
E:\TekH\Visual Studio\DDWeb\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\refint\DigitalData.Core.Application.dll
|
||||
E:\TekH\Visual Studio\DDWeb\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\DigitalData.Core.Application.pdb
|
||||
E:\TekH\Visual Studio\DDWeb\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\ref\DigitalData.Core.Application.dll
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.Application.deps.json
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.Application.dll
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.Application.pdb
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.Contracts.dll
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.Contracts.pdb
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\DigitalData.Core.Application.csproj.AssemblyReference.cache
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\DigitalData.Core.Application.GeneratedMSBuildEditorConfig.editorconfig
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\DigitalData.Core.Application.AssemblyInfoInputs.cache
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\DigitalData.Core.Application.AssemblyInfo.cs
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\DigitalData.Core.Application.csproj.CoreCompileInputs.cache
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\DigitalData.Core.Application.csproj.CopyComplete
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\DigitalData.Core.Application.dll
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\refint\DigitalData.Core.Application.dll
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\DigitalData.Core.Application.pdb
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Application\obj\Debug\net7.0\ref\DigitalData.Core.Application.dll
|
||||
|
||||
Reference in New Issue
Block a user