Table of Contents

Class ActorResourceCommandHandler<TCommand, TResource, TResponse>

Namespace
Trellis.Mediator
Assembly
Trellis.Mediator.dll

Supplies the checked actor and directly authorized resource to command business logic.

public abstract class ActorResourceCommandHandler<TCommand, TResource, TResponse> : ICommandHandler<TCommand, TResponse> where TCommand : ICommand<TResponse>, IAuthorizeResource<TResource> where TResource : class where TResponse : IResult, IFailureFactory<TResponse>

Type Parameters

TCommand

A directly resource-authorized command; static permissions are optional.

TResource

The reference-type resource loaded by the pipeline.

TResponse

A result-compatible response.

Inheritance
ActorResourceCommandHandler<TCommand, TResource, TResponse>
Implements
ICommandHandler<TCommand, TResponse>
Inherited Members
Extension Methods

Methods

Handle(TCommand, CancellationToken)

public ValueTask<TResponse> Handle(TCommand command, CancellationToken cancellationToken)

Parameters

command TCommand
cancellationToken CancellationToken

Returns

ValueTask<TResponse>

Handle(TCommand, Actor, TResource, CancellationToken)

Executes command business logic with the exact checked actor and loaded resource.

protected abstract ValueTask<TResponse> Handle(TCommand command, Actor actor, TResource resource, CancellationToken cancellationToken)

Parameters

command TCommand

The command to handle.

actor Actor

The actor checked by this dispatch.

resource TResource

The same resource instance loaded and authorized by this dispatch.

cancellationToken CancellationToken

The dispatch cancellation token.

Returns

ValueTask<TResponse>

The business outcome.