Why not IRequestHandler<TRequest>?
See original GitHub issueFor requests that do not need to return a value, the docs say to use the RequestHandler
base class.
Why not just overload the IRequestHandler
interface like so?
public interface IRequestHandler<in TRequest, out TResponse>
where TRequest : IRequest<TResponse>
{
TResponse Handle(TRequest message);
}
public interface IRequestHandler<in TRequest>
where TRequest : IRequest
{
void Handle(TRequest message);
}
It would be more consistent, and avoid unnecessary inheritance.
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (11 by maintainers)
Top Results From Across the Web
MediatR IPipelineBehavior<TRequest, TResponse> errors ...
0.0 I started getting the below compilation error. The type 'TRequest' cannot be used as type parameter 'TRequest' in the generic type or...
Read more >Why I don't use MediatR for CQRS
In MediatR we don't have concepts like Commands and Queries . There's a more generic thing called the Request , represented by IRequest<T>...
Read more >CQRS and MediatR in ASP.NET Core
MediatR Requests are very simple request-response style messages, where a single request is synchronously handled by a single handler ( ...
Read more >MediatR and AspNet 7
In MediatR's case, there is a IRequestHandler<TRequest, TResponse> and a IRequest<TResponse> (no TResponse versions of the interfaces ...
Read more >MediatR 12.0 Released
Making "void" request handlers return Task instead of Unit; IRequest does not inherit IRequest<Unit> instead IBaseRequest; Consolidating the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
One other thing - having two interfaces makes it quite a bit harder to build your own decorators. Having a single interface is better.
Cause it’s much easier to deal with a single interface with two generic arguments than two different ones with different generic arguments 😄