ASP.NET Core: Implementing CQRS and MediatR pattern in ASP.NET Core API
In this article, we will see an implementation of the Command Query Responsibility Segregation (CQRS) pattern in ASP.NET Core API with MediatR. In my earlier article , I have already explained the CQRS. In this article, we will focus on Mediator Pattern. Mediator Pattern Mediator is a behavioral design pattern that reduces coupling between components of the program. This is achieved by using a special mediator object. This object decouples components by managing indirect communication across them. This pattern makes the application easy to extend, reuse, and modify individual components because they do not have any direct dependency across them. Figure 1, will provide a good idea of the Mediator pattern. Figure 1: The Mediator Pattern As shown in Figure 1, the Mediator object is responsible for listening to requests from each service object and passing them to the actual Handler object hence implementing the decoupling across the Services and Handlers. This helps to further ...