Implementierung von Enum-basierter Nachrichtenverarbeitung in ResponseService
Erweitern Sie den ResponseService, um Enum-Arrays für Nachrichten zu akzeptieren, und konvertieren Sie sie zu Strings für die Kompatibilität. Beinhaltet aktualisierte Dokumentationskommentare und gewährleistet Rückwärtskompatibilität.
This commit is contained in:
@@ -66,5 +66,67 @@
|
||||
/// <param name="messages">An array of failure messages associated with the operation. These provide detail about why the operation failed.</param>
|
||||
/// <returns>A failed service result. The data part of the result will be set to the default value for the specified type.</returns>
|
||||
IServiceResult<T> Failed<T>(params string[] messages);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a service message using enumeration values.
|
||||
/// </summary>
|
||||
/// <param name="isSuccess">Indicates if the operation was successful.</param>
|
||||
/// <param name="messages">The enumeration values associated with the operation.</param>
|
||||
/// <returns>A service message indicating the outcome of the operation and any associated enumeration values.</returns>
|
||||
IServiceMessage CreateMessage(bool isSuccess, params Enum[] messages);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a service result with the specified data and enumeration values for messages.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of data the service result will contain.</typeparam>
|
||||
/// <param name="data">The data for the service result.</param>
|
||||
/// <param name="isSuccess">Indicates if the operation was successful.</param>
|
||||
/// <param name="messages">The enumeration values associated with the operation.</param>
|
||||
/// <returns>A service result containing the data and indicating the outcome of the operation with enumeration values.</returns>
|
||||
IServiceResult<T> CreateResult<T>(T? data, bool isSuccess, params Enum[] messages);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a successful service message using enumeration values.
|
||||
/// </summary>
|
||||
/// <param name="messages">The success enumeration values.</param>
|
||||
/// <returns>A successful service message.</returns>
|
||||
IServiceMessage Successful(params Enum[] messages);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a failed service message using enumeration values.
|
||||
/// </summary>
|
||||
/// <param name="messages">The failure enumeration values.</param>
|
||||
/// <returns>A failed service message.</returns>
|
||||
IServiceMessage Failed(params Enum[] messages);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a successful service result with the specified data, using enumeration values for messages.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of data the service result will contain.</typeparam>
|
||||
/// <param name="data">The data to include in the service result.</param>
|
||||
/// <param name="messages">The success enumeration values.</param>
|
||||
/// <returns>A successful service result containing the data.</returns>
|
||||
IServiceResult<T> Successful<T>(T data, params Enum[] messages);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a failed service result, optionally including data, using enumeration values for messages.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of data the service result can contain.</typeparam>
|
||||
/// <param name="data">Optional data to include in the failed service result.</param>
|
||||
/// <param name="messages">The failure enumeration values.</param>
|
||||
/// <returns>A failed service result, which may or may not contain data.</returns>
|
||||
IServiceResult<T> Failed<T>(T? data = default, params Enum[] messages);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a failed service result without explicitly including data, using only enumeration values for failure messages.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This overload is useful when you want to indicate a failure without the need to return any specific data,
|
||||
/// but still want to provide details about the failure through enumeration values.
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">The type of data the service result can contain. The result will contain the default value for this type.</typeparam>
|
||||
/// <param name="messages">An array of enumeration values associated with the operation. These provide detail about why the operation failed.</param>
|
||||
/// <returns>A failed service result. The data part of the result will be set to the default value for the specified type.</returns>
|
||||
IServiceResult<T> Failed<T>(params Enum[] messages);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="icon.png" Pack="true" PackagePath=""/>
|
||||
<None Include="icon.png" Pack="true" PackagePath="" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
|
||||
<PackageReference Include="System.DirectoryServices" Version="7.0.1" />
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="icon.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB |
@@ -34,7 +34,6 @@ E:\TekH\Visual Studio\DDWeb\WebCoreModules\DigitalData.Core.Contracts\obj\Debug\
|
||||
E:\TekH\Visual Studio\DDWeb\WebCoreModules\DigitalData.Core.Contracts\obj\Debug\net7.0\refint\DigitalData.Core.Contracts.dll
|
||||
E:\TekH\Visual Studio\DDWeb\WebCoreModules\DigitalData.Core.Contracts\obj\Debug\net7.0\DigitalData.Core.Contracts.pdb
|
||||
E:\TekH\Visual Studio\DDWeb\WebCoreModules\DigitalData.Core.Contracts\obj\Debug\net7.0\ref\DigitalData.Core.Contracts.dll
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Contracts\bin\Debug\net7.0\icon.png
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Contracts\bin\Debug\net7.0\DigitalData.Core.Contracts.deps.json
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Contracts\bin\Debug\net7.0\DigitalData.Core.Contracts.dll
|
||||
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.Contracts\bin\Debug\net7.0\DigitalData.Core.Contracts.pdb
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user