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

34 lines
772 B
Markdown

# Core Interfaces
Quick reference for command and query handler interfaces.
## ICommandHandler
```csharp
// 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
```csharp
public interface IQueryHandler<in TQuery, TResult> where TQuery : class
{
Task<TResult> HandleAsync(TQuery query, CancellationToken ct = default);
}
```
## See Also
- [API Reference Overview](README.md)
- [Commands Documentation](../core-features/commands/README.md)