Fügen Sie 'ohne Nachricht' Methoden in ResponseService hinzu

Implementieren und dokumentieren Sie Dienstmethoden, die ohne zusätzliche Nachrichten funktionieren, um die Einfachheit der Schnittstelle zu verbessern.
This commit is contained in:
Developer 02
2024-04-18 14:29:11 +02:00
parent 7b0ef9b0c2
commit c350c63b1f
38 changed files with 112 additions and 9 deletions

View File

@@ -5,6 +5,55 @@
/// </summary>
public interface IResponseService
{
#region WITHOUT_MESSAGE
/// <summary>
/// Creates a simple service message indicating success or failure without any additional messages.
/// </summary>
/// <param name="isSuccess">Indicates if the operation was successful.</param>
/// <returns>A service message indicating the outcome of the operation without any messages.</returns>
IServiceMessage CreateMessage(bool isSuccess);
/// <summary>
/// Creates a service result with the specified data and a success flag, without any additional 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>
/// <returns>A service result containing the data and indicating the outcome of the operation without any messages.</returns>
IServiceResult<T> CreateResult<T>(T? data, bool isSuccess);
/// <summary>
/// Creates a service message indicating a successful operation without any messages.
/// </summary>
/// <returns>A service message indicating a successful operation.</returns>
IServiceMessage Successful();
/// <summary>
/// Creates a service message indicating a failed operation without any messages.
/// </summary>
/// <returns>A service message indicating a failed operation.</returns>
IServiceMessage Failed();
/// <summary>
/// Creates a successful service result with the specified data, without any 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>
/// <returns>A successful service result containing the data, indicating a successful operation without any messages.</returns>
IServiceResult<T> Successful<T>(T data);
/// <summary>
/// Creates a failed service result, optionally including data, without any 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>
/// <returns>A failed service result, which may or may not contain data, indicating a failed operation without any messages.</returns>
IServiceResult<T> Failed<T>(T? data = default);
#endregion
#region WITH_STRING_MESSAGE
/// <summary>
/// Creates a service message.
/// </summary>
@@ -67,6 +116,9 @@
/// <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);
#endregion
#region WITH_ENUM_MESSAGE
/// <summary>
/// Creates a service message using enumeration values.
/// </summary>
@@ -128,5 +180,6 @@
/// <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);
#endregion
}
}