Class PipelineBehaviorBase<TRequest, TResponse>
- Namespace
- Arbiter.CommandQuery.Behaviors
- Assembly
- Arbiter.CommandQuery.dll
A base pipeline behavior to surround the inner handler
public abstract class PipelineBehaviorBase<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : class, IRequest<TResponse>
Type Parameters
TRequest
The type of request being handled.
TResponse
The type of response from the handler.
- Inheritance
-
PipelineBehaviorBase<TRequest, TResponse>
- Implements
-
IPipelineBehavior<TRequest, TResponse>
- Derived
- Inherited Members
Constructors
PipelineBehaviorBase(ILoggerFactory)
Initializes a new instance of the PipelineBehaviorBase<TRequest, TResponse> class.
protected PipelineBehaviorBase(ILoggerFactory loggerFactory)
Parameters
loggerFactory
ILoggerFactoryThe logger factory to create an ILogger for this handler.
Exceptions
- ArgumentNullException
When
loggerFactory
is null
Properties
Logger
Gets the ILogger for this pipeline behavior.
protected ILogger Logger { get; }
Property Value
Methods
Handle(TRequest, RequestHandlerDelegate<TResponse>, CancellationToken)
Pipeline handler to perform any additional behavior and await the next
delegate as necessary
public virtual 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
Process(TRequest, RequestHandlerDelegate<TResponse>, CancellationToken)
Processes the specified request with the additional behavior.
protected abstract ValueTask<TResponse?> Process(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
Parameters
request
TRequestThe incoming request.
next
RequestHandlerDelegate<TResponse>Awaitable delegate for the next action in the pipeline. Eventually this delegate represents the handler.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- ValueTask<TResponse>
Awaitable task returning the
TResponse