Owneat Technical Guide main Help

Class RequestLoggingHandlingBehavior<TRequest, TResponse\>

Namespace: Common.Behaviors
Assembly: Common.dll

public class RequestLoggingHandlingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : IRequest<TResponse>

Type Parameters

TRequest

TResponse

Inheritance

object ← RequestLoggingHandlingBehavior<TRequest, TResponse\>

Implements

IPipelineBehavior<TRequest, TResponse\>

Inherited Members

object.Equals\(object?\), object.Equals\(object?, object?\), object.GetHashCode\(\), object.GetType\(\), object.MemberwiseClone\(\), object.ReferenceEquals\(object?, object?\), object.ToString\(\)

Constructors

RequestLoggingHandlingBehavior\(ILogger<RequestLoggingHandlingBehavior<TRequest, TResponse\>\>\)

public RequestLoggingHandlingBehavior(ILogger<RequestLoggingHandlingBehavior<TRequest, TResponse>> logger)

Parameters

logger ILogger

Methods

Handle\(TRequest, RequestHandlerDelegate<TResponse\>, CancellationToken\)

Handles and processes the incoming request, logging the start and completion of the request. It also manages success and failure cases for requests that return a standard API response : LanguageExt.Common.Result%601. If the response is not of the expected type, a warning log message is generated.

public Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken)

Parameters

request TRequest

The incoming request object to be processed.

next RequestHandlerDelegate<TResponse\>

The next delegate in the request processing pipeline.

cancellationToken CancellationToken

A cancellation token that can be used to cancel the request processing.

Returns

Task <TResponse\>

A task that represents the asynchronous operation, with a result of type TResponse.

Last modified: 21 May 2024