This template adheres to the Command Query Responsibility Segregation (CQRS) pattern, enabling a separation of read and write responsibilities in the system. This enhances scalability and performance. Additionally, it incorporates Clean Architecture, making the project easily maintainable and testable.
To ensure code flexibility and reusability, the Generic Repository pattern is used in conjunction with the Unit of Work pattern. These patterns simplify the interaction with data resources and enable more efficient control of transactions and operations in the database.
The project also implements a front-end design in Blazor with the most basic components to create a simple system from scratch while reusing dynamic components.
- Badge
- Button
- Container
- DropDown
- Input
- Label
- Modal
- Spinner
- Notifications
- Pagination
- AccessDenied
- NotFound
- RedirectToPage
- Accordion
- Alerts
- Breadcrumb
- Card
- Carousel
- Collapse
- SidebarMenu
- NavbarMenu
- Placeholder
- Popovers
- Progress
- Tooltips
- Scheduler
- Dialog (a better modal service)
- Layouts
- ProfileMenu
- Steps
- Tabs
- DynamicForms
- TemplateForms
- Rating
- SelectBar
- Slider
- Upload
- Charts (Pies, Lines, Bars)
The project uses JWT authentication to authorize the endpoints, which are developed in MinimalAPI. All these are implemented in .NET 7 and with potential databases in MySQL or MSSQL.
The project incorporates xUnit and Moq for unit testing and uses EF Core InMemory for integration testing.
- Clone the repository
- Navigate to the project folder
- Install the necessary dependencies
- Create models and DTOs in the following directories:
TemplateCQRS.Domain > Models
TemplateCQRS.Domain > DTOs
- Each class will have its own folder in the
Features
directory inTemplateCQRS.Application
. The typical structure is:FeatureName > Commands > FeatureClassCommand.cs
here you put all the commands.FeatureName > Handlers > CreateFeatureClassCommandHandler.cs
FeatureName > Handlers > GetFeatureClassQueryHandler.cs
FeatureName > Queries > FeatureClassQuery.cs
here you put all the queries.FeatureName > Validators > FeatureClassValidator.cs
here you put all the validators.FeatureName > FeatureClassMappingProfile.cs
here you put all the mappings.
5.1 You will have a folder Snippets with a Visual Studio Extension to create this patter above. In order to use it you will need to create the model and the dto's first, then right click on the folder "Features" and select "New CQRS Template" you will be prompt to enter the name of the model then press "Ok" and it will use all the snippets inside the folder "CQRS" to create each class generic.
Use this project as a template for new solutions that will be developed.