Answer the question
In order to leave comments, you need to log in
How to make a command handler interface?
There are 2 types of commands in my code:
1. Returning a result
2. Not returning a result (Unit is a "dummy" type)
public interface ICommand : ICommand<Unit>{}
public interface ICommand<TResult>{}
public ICommandHandler<in TCommand> where TCommand : class, ICommand {
Task Handle(TCommand command, CancellationToken cancellationToken = default(CancellationToken));
}
public ICommandHandler<in TCommand, TResult> where TCommand : class, ICommand<TResult> {
Task<TResult> Handle(TCommand command, CancellationToken cancellationToken = default(CancellationToken));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question