Questa pagina non è ancora tradotta in italiano: qui la trovi in inglese.
IMentorQueryHandler<TQuery, TResult>
The IMentorQueryHandler<TQuery, TResult> interface of Novior.MentorAgent.Abstractions.Interfaces: Handles a query: a request that only reads, written as a…
On this page
Handles a query: a request that only reads, written as a type of its own, usually a record. Registered with MentorOptions.Actions.AddQuery<TQuery, THandler>(), the query is one of the coordinator's actions, named after TQuery in snake_case and always read-only: the model gives the query's properties as the action's arguments, MentorAgent passes the query it built from them to IMentorQueryHandler<TQuery, TResult>.HandleAsync, and the model reads the result.
The handler is a service the application registers itself. An application that already sends its queries through a dispatcher, MediatR for example, writes a handler that sends the query on.
Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Abstractions.Interfaces. Package: Novior.MentorAgent.Abstractions.
public interface IMentorQueryHandler<TQuery, TResult>
dotnet add package Novior.MentorAgent.AbstractionsMethods
Section titled “Methods”HandleAsync
Section titled “HandleAsync”Task<TResult?> HandleAsync(TQuery query, CancellationToken cancellationToken)
Answers query. An exception fails the action, and the model reads that it failed.
Parameters
query: The query, built from the model's arguments.cancellationToken: Cancelled when the turn is.
Returns: The result the model reads.
