2 ms·
I never heard of MediatR before today, but what do you think of message buses like IMessenger from MVVM Toolkit? https://learn.microsoft.com/en-us/dotnet/commun
by dgellow 3y ago
I never heard of MediatR before today, but what do you think of message buses like IMessenger from MVVM Toolkit? https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/messenger https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mv...
I've been mostly using C# for GUI applications and recently have been thinking about relying on a message bus as the main communication device between services and view models. As you mentions that complicates the flow of logic and ones loses benefits of explicitly listing your dependencies you get by just injecting all your services via constructor parameters. But that makes it simpler to refactor complex view models and services without impacting the rest of the codebase (at least in theory, it's of course often messier in practice...).
- neonsunset 3y agoOh yeah, GUI applications impose completely different requirements and use messaging very often, the comment above was specifically addressed at a popular anti-pattern in back-end services. Community Toolkit code is well written and often exists as "does not quite meet the bar for including in standard library but otherwise solves common use cases".
- dgellow 3y agoThanks! Yes, I found all the community toolkit libraries to be really high quality, Sergio Pedri does a fantastic job.