The CodeGenerator is a powerful tool designed to streamline the development process in an Onion Architecture-based .NET 6 project. It automates the generation of code for various architectural layers, including Domain, Application, Infrastructure, Persistence, and WebAPI.
The Domain layer is responsible for defining the core business logic and entities of your application. The CodeGenerator simplifies domain entity creation by:
- Generating domain entity classes.
- Creating value objects and aggregates.
- Todo:Handling relationships and associations between entities.
The Application layer contains the application's use cases and orchestrates interactions between the Domain layer and the external world. The CodeGenerator assists in this layer by:
- Generating application service classes.
- Creating DTOs (Data Transfer Objects) for input and output.
- Implementing application use cases.
The Infrastructure layer provides support for various technical concerns, such as data access, caching, and external services integration. The CodeGenerator helps you set up this layer by:
- Generating data access classes, including repositories.
- Creating cache and external service integration components.
- Handling configuration and dependency injection.
The Persistence layer is responsible for data storage and retrieval. The CodeGenerator simplifies database-related tasks by:
- Generating database context and entity configurations.
- Creating migration scripts for database schema updates.
- Managing database seed data.
The WebAPI layer exposes your application's functionality through HTTP endpoints. The CodeGenerator accelerates WebAPI development by:
- Generating API controllers for your application services.
- Creating request and response models for API endpoints.
- Handling routing and authentication configuration.
To use the CodeGenerator in your project, follow these steps:
- Clone or download the repository containing the CodeGenerator.
- Configure the CodeGenerator settings to match your project's needs.
- Build
- Get Extention file from debug folder where it is located
- Install Ententions
- Open Vs2022 Click on Generator button from Menu > Tool > CodeGenerator
- Define Class Access Modifier and Name
- Click Add button
- Click on class you added on datagrid
- Define properities
- close window
- click on Generate button
Here's an example command to run the CodeGenerator: