IMentorCommandHandler<TCommand> interface
The IMentorCommandHandler<TCommand> interface of Novior.MentorAgent.Abstractions.Interfaces: Handles a command: a request that changes data, written as a…
On this page
Handles a command: a request that changes data, written as a type of its own, usually a record. Registered with MentorOptions.Actions.AddCommand<TCommand, THandler>(), the command is one of the coordinator's actions, named after TCommand in snake_case: the model gives the command's properties as the action's arguments, and MentorAgent passes the command it built from them to IMentorCommandHandler<TCommand>.HandleAsync. A command is a write, so the default confirmation for writes applies to it.
The handler is a service the application registers itself. An application that already sends its commands through a dispatcher, MediatR for example, writes a handler that sends the command on.
Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Abstractions.Interfaces. Package: Novior.MentorAgent.Abstractions.
public interface IMentorCommandHandler<TCommand>
dotnet add package Novior.MentorAgent.AbstractionsMethods
Section titled “Methods”HandleAsync
Section titled “HandleAsync”Task HandleAsync(TCommand command, CancellationToken cancellationToken)
Runs command. An exception fails the action, and the model reads that it failed.
Parameters
command: The command, built from the model's arguments.cancellationToken: Cancelled when the turn is.
