Interface IPipelineBehavior<TRequest, TResponse>
An interface for a pipeline behavior to surround the inner handler. Implementations add additional behavior and await the next delegate.
public interface IPipelineBehavior<in TRequest, TResponse> where TRequest : notnull
Type Parameters
TRequest
The type of request being sent
TResponse
The type of response from the handler
Remarks
There can be multiple pipeline behaviors for a request handler.
Methods
Handle(TRequest, RequestHandlerDelegate<TResponse>, CancellationToken)
Pipeline handler to perform any additional behavior and await the next
delegate as necessary
ValueTask<TResponse?> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken = default)
Parameters
request
TRequestThe request being sent
next
RequestHandlerDelegate<TResponse>Awaitable delegate for the next action in the pipeline. Eventually this delegate represents the handler.
cancellationToken
CancellationTokenCancellation token
Returns
- ValueTask<TResponse>
Awaitable task returning the
TResponse