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.

Reduced IMediator interface

See original GitHub issue
public 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:23 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
jbogardcommented, Dec 19, 2016

@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?

0reactions
jbogardcommented, Dec 20, 2016

Well it’s merged now anyway.

Read more comments on GitHub >

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

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