Table of Contents

Class MediatorDispatcher

Namespace
Arbiter.CommandQuery.Dispatcher
Assembly
Arbiter.CommandQuery.dll

A dispatcher that uses IMediator to send requests. Use for Blazor Interactive Server rendering mode.

public class MediatorDispatcher : IDispatcher
Inheritance
MediatorDispatcher
Implements
Inherited Members

Constructors

MediatorDispatcher(IMediator)

Initializes a new instance of the MediatorDispatcher class.

public MediatorDispatcher(IMediator mediator)

Parameters

mediator IMediator

The IMediator to send request to.

Exceptions

ArgumentNullException

When mediator is null

Methods

Send<TResponse>(IRequest<TResponse>, CancellationToken)

Sends a request to the message dispatcher.

public ValueTask<TResponse?> Send<TResponse>(IRequest<TResponse> request, CancellationToken cancellationToken = default)

Parameters

request IRequest<TResponse>

The request being sent

cancellationToken CancellationToken

Cancellation token

Returns

ValueTask<TResponse>

Awaitable task returning the TResponse

Type Parameters

TResponse

The type of response from the dispatcher

Send<TRequest, TResponse>(TRequest, CancellationToken)

Sends a request to the message dispatcher.

public ValueTask<TResponse?> Send<TRequest, TResponse>(TRequest request, CancellationToken cancellationToken = default) where TRequest : IRequest<TResponse>

Parameters

request TRequest

The request being sent

cancellationToken CancellationToken

Cancellation token

Returns

ValueTask<TResponse>

Awaitable task returning the TResponse

Type Parameters

TRequest

The type of request being sent

TResponse

The type of response from the dispatcher