Updated Command & Query Handlers

I’ve recently updated my definitions for Query Handlers. I’ve changed the original IQuery<Tresult> to IReturn<TResult> as, for me, it better reflects the intention of the [marker] interface.

public interface ICommandHandler<TCommand>
{
    void Execute(TCommand command);
}

public interface IReturn<TResult>
{
}

public interface IQueryHandler<TQuery, TResult> where TQuery : IReturn<TResult>
{
    TResult Execute(TQuery query);
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.