Table of Contents

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 ILoggerFactory

The 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

ILogger

The ILogger for this pipeline behavior.

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 TRequest

The request being sent

next RequestHandlerDelegate<TResponse>

Awaitable delegate for the next action in the pipeline. Eventually this delegate represents the handler.

cancellationToken CancellationToken

Cancellation 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 TRequest

The incoming request.

next RequestHandlerDelegate<TResponse>

Awaitable delegate for the next action in the pipeline. Eventually this delegate represents the handler.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<TResponse>

Awaitable task returning the TResponse