question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why not IRequestHandler<TRequest>?

See original GitHub issue

For 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:closed
  • Created 7 years ago
  • Comments:16 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
jbogardcommented, Sep 15, 2016

One other thing - having two interfaces makes it quite a bit harder to build your own decorators. Having a single interface is better.

1reaction
khellangcommented, Aug 31, 2016

Cause it’s much easier to deal with a single interface with two generic arguments than two different ones with different generic arguments 😄

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found