dotnet-cqrs/docs/api-reference/core-interfaces.md

772 B

Core Interfaces

Quick reference for command and query handler interfaces.

ICommandHandler

// Command without result
public interface ICommandHandler<in TCommand> where TCommand : class
{
    Task HandleAsync(TCommand command, CancellationToken ct = default);
}

// Command with result
public interface ICommandHandler<in TCommand, TResult> where TCommand : class
{
    Task<TResult> HandleAsync(TCommand command, CancellationToken ct = default);
}

IQueryHandler

public interface IQueryHandler<in TQuery, TResult> where TQuery : class
{
    Task<TResult> HandleAsync(TQuery query, CancellationToken ct = default);
}

See Also