I built a simple structure. This project is an implementation of the Clean Architecture with the CQRS Pattern using .NET 9. The Clean Architecture provides a robust and flexible software design that can easily adapt to changes and maintainability. CQRS (Command Query Responsibility Segregation) pattern separates the application into two parts: Commands and Queries. Commands are responsible for modifying the state of the application, while Queries are responsible for retrieving data. The separation of concerns enables scalability and performance optimization for the application.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- .NET 9 SDK
- Visual Studio 2022 or Visual Studio Code or JetBrains Rider 2024.*
- Clone the repository:
git clone https://github.com/Rezakazemi890/Clean-Architecture-CQRS.git
-
Open the solution file
CleanArchitectureCQRS.sln
in Visual Studio. -
Build the solution by pressing
Ctrl + Shift + B
or by navigating to Build -> Build Solution. -
Run the application by pressing
F5
or by navigating to Debug -> Start Debugging.
The project includes unit tests that can be run using the Test Explorer in Visual Studio or by running the following command in the terminal:
dotnet test
The Clean Architecture with CQRS Pattern consists of the following layers:
-
API Layer: This layer contains the user interface components of the application. It is responsible for handling user input and displaying output. The presentation layer communicates with the Application Layer using DTOs (Data Transfer Objects).
-
Application Layer: This layer contains the business logic of the application. It is responsible for coordinating the use cases of the application. The Application Layer communicates with the Domain Layer using commands and queries.
-
Domain Layer: This layer contains the core entities and business logic of the application. It is responsible for defining the rules and behaviors of the application.
-
Infrastructure Layer: This layer contains the implementation details of the application. It is responsible for communicating with external systems and services. The Infrastructure Layer communicates with the Application Layer using repositories and data access objects.
-
Shared Layer: This layer contains the implementation of common and shared abstractions or details that can be used by other layers.
- .NET 9
- ASP.NET Core
- Entity Framework Core
- xUnit
This project is licensed under the MIT License - see the License.md file for details.