Class RequestPostProcessorBehavior<TRequest, TResponse>
Runs every registered IRequestPostProcessor<TRequest, TResponse> after the handler.
public sealed class RequestPostProcessorBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : notnull
Type Parameters
TRequestThe request type.
TResponseThe response type.
- Inheritance
-
RequestPostProcessorBehavior<TRequest, TResponse>
- Implements
-
IPipelineBehavior<TRequest, TResponse>
- Inherited Members
Remarks
This stage is not registered as an IPipelineBehavior<TRequest, TResponse>. In a container set up with
AddCaesar, the mediator composes it into the pipeline of each request type that has at least one
post-processor, and of no other, in the documented order: inside the exception stages and the pre-processors,
outside every pipeline behavior. Neither the number nor the order of AddCaesar calls changes that, and
post-processors registered after AddCaesar count too. If this behavior is registered as a pipeline behavior
anyway, the mediator leaves its own stage out, so the post-processors run once, at that registration's position.
Constructors
RequestPostProcessorBehavior(IEnumerable<IRequestPostProcessor<TRequest, TResponse>>)
Creates the behavior.
public RequestPostProcessorBehavior(IEnumerable<IRequestPostProcessor<TRequest, TResponse>> postProcessors)
Parameters
postProcessorsIEnumerable<IRequestPostProcessor<TRequest, TResponse>>The post-processors to run, in registration order.
Methods
Handle(TRequest, RequestHandlerDelegate<TResponse>, CancellationToken)
Handles the request, calling next to continue the pipeline.
public Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
Parameters
requestTRequestThe request.
nextRequestHandlerDelegate<TResponse>Continues the pipeline. Not calling it short-circuits the request.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TResponse>