Reduced IMediator interface
See original GitHub issuepublic interface IMediator
{
Task<TResponse> SendAsync<TResponse>(IRequest<TResponse> request, CancellationToken cancellationToken = default(CancellationToken));
Task SendAsync(IRequest request, CancellationToken cancellationToken = default(CancellationToken));
Task PublishAsync(INotification notification, CancellationToken cancellationToken = default(CancellationToken));
}
I’d keep all the existing handler interfaces, and inside the Mediator class decide which one is the right one to instantiate through cascading checks and then a cache to the right request.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:23 (18 by maintainers)
Top Results From Across the Web
Mediator pattern - Wikipedia
Objects no longer communicate directly with each other, but instead communicate through the mediator. This reduces the dependencies between communicating ...
Read more >Mediator
Mediator is a behavioral design pattern that lets you reduce chaotic dependencies between objects. The pattern restricts direct communications between the ...
Read more >Design patterns: Mediator
Reducing the number of connections between classes. Encapsulation of objects using the mediator interface. · You want to get rid of many ...
Read more >Mediator design pattern
Mediator design pattern is one of the important and widely used behavioral design pattern. Mediator enables decoupling of objects by ...
Read more >Mediator Design Pattern - Scaler Topics
The Mediator pattern focuses on acting as a bridge between items to facilitate communication and aid in the implementation of lose-coupling between components....
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
@remcoros yes. Supporting both models is annoying to say the least, and since calling frameworks are generally async-friendly (MVC back many versions, WPF w/ any modern MVVM frameworks, Xamarin too, messaging frameworks of NSB and MassTransit), it’s likely users calling code can be easily async.
But I’ve only confirmed this with our apps that use MediatR, where are you calling into it?
Well it’s merged now anyway.