Category: Using MediatR as a mediatorPage 1 of 2
The following points are downsides that we can tame as upsides: A way to start refactoring that business logic would be to push the logic into the domain…
On the upside, we have the following: From my experience, features tend to start small and grow over time. The users often find out what they need while…
Instead of separating an application horizontally (layers), a vertical slice groups all horizontal concerns together to encapsulate a feature. Here is a diagram that illustrates that: Figure 17.1:…
Before you begin: Join our book community on Discord Give your feedback straight to the author himself and chat to other early readers on our Discord server (find…
If you need markers to inject some specific dependency in a particular class, you are most likely cheating the Inversion of Control principle. Instead, you should find a…
The CQS and CQRS patterns suggest dividing the operations of a program into commands and queries. A command mutates data, and a query fetches data. We can apply…
The test program setup is composed of the following: Once again, the names of the participants are randomly generated. The TestMessageWriter implementation is a little different and accumulates…
We cover ways to organize commands and queries in subsequent chapters. Let’s start with the JoinChatRoom feature: public class JoinChatRoom{ public record class Command(IChatRoom ChatRoom, IParticipant Requester) :…
That class could hardly be simpler: it takes a name and an IMessageWriter<TMessage> implementation when created, then it stores a reference for future use.The IMessageWriter<TMessage> interface serves as…
The Mediator pattern is another GoF design pattern that controls how objects interact with one another (making it a behavioral pattern). Goal The mediator’s role is to manage…