Init
This commit is contained in:
25
Prefab/Handler/IHandler.cs
Normal file
25
Prefab/Handler/IHandler.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace Prefab.Handler;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a handler that processes a request and returns a response asynchronously.
|
||||
/// </summary>
|
||||
/// <remarks>Implementations of this interface encapsulate the logic required to handle a specific request and
|
||||
/// produce a result. Handlers are typically used in command or query processing pipelines to separate request handling
|
||||
/// logic from other application concerns.</remarks>
|
||||
/// <typeparam name="TResponse">The type of the response returned by the handler.</typeparam>
|
||||
public interface IHandler<TResponse>
|
||||
{
|
||||
Task<TResponse> Execute(CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a contract for handling a request and producing a response asynchronously.
|
||||
/// </summary>
|
||||
/// <remarks>Implementations of this interface should be thread-safe if they are intended to be used concurrently.
|
||||
/// The interface is typically used in request/response or command/query processing pipelines.</remarks>
|
||||
/// <typeparam name="TRequest">The type of the request to be handled.</typeparam>
|
||||
/// <typeparam name="TResponse">The type of the response returned after handling the request.</typeparam>
|
||||
public interface IHandler<in TRequest, TResponse>
|
||||
{
|
||||
Task<TResponse> Execute(TRequest request, CancellationToken cancellationToken);
|
||||
}
|
||||
Reference in New Issue
Block a user