Showing posts from July, 2023

ASP.NET Core: Creating Resilient Microservices

In this article,  we will see how to implement resilient Microservices using ASP.NET Core. The question here is why we need to implement such a design for the Microservices? Consider, the design for Microservices shown in Figure 1 Figure 1: The Direct Access of Microservices from the client application  As shown in Figure 1, the E-Commerce client application directly accesses Product and Customer Microservices. The client application will be able to receive data from these services successfully if the Product and the Customer services are up and running. But in case one of these services is down because of some errors, then the client application will not get the data and hence might be a reason to crash the client app. In this case, although the client app is not responsible for the stability of the Microservices still any issue that occurs in Microservices will crash the client application.  The question here is, how to resolve such kind of a design flow in our application? The solut

ASP.NET Core: Implementing CQRS Pattern

In this post, we will be implementing Command Query Responsibility   Segregation (CQRS) pattern. This pattern is used to separate read and write operations for a data store. The advantage of implementing this pattern is to increase performance, scalability, and security.  What is the  Command Query Responsibility  Segregation (CQRS) pattern? In the CQRS pattern, the Command refers to a Database command that represents Insert, Update, and Delete Operations. The Query means the Read operations from the Data Store. This means that we are separating Read and Operations separately to provide service access to callers who are interested in performing either Read or Write operations at a time.     Why do we need CQRS Pattern? Technically the CQRS implementation helps us to create separate services (APIs) for reading data and writing data. This is useful when we want to use the same data store for performing Read/Write operations. If we implement the logic for performing Read/Write operations