Overview
Chapi Assistant provides powerful code generation capabilities for .NET WPF projects, automatically creating modules with Domain, Application, Infrastructure, and API layers following Clean Architecture principles.Code generation is powered by Roslyn-based code analysis and manipulation for type-safe, production-ready code.
Module Generation
Generate Complete Modules
Create full-stack modules with all architectural layers in one command:- Single Module
- Multiple Modules
- Database Selection
Generate a single module:Creates:
- Domain entities and value objects
- Application use cases
- Infrastructure repositories
- API controllers and endpoints
API Endpoint Generation
Add Individual Endpoints
Generate specific API endpoints for existing modules:Path to the project root directory.
Name of the module (e.g., “Customer”, “Product”).
HTTP operation type: “Create”, “Read”, “Update”, “Delete”, “List”.
Name of the API method to generate.
Whether to generate the corresponding Application layer use case (default: false).
Supported Operations
Create
POST endpoint for creating new entities
Read
GET endpoint for retrieving a single entity
Update
PUT endpoint for updating existing entities
Delete
DELETE endpoint for removing entities
List
GET endpoint for retrieving multiple entities
Layer-Specific Generation
Generate code for specific architectural layers:- Application Layer
- Domain Layer
- Infrastructure Layer
Add application layer methods (use cases):Generates:
- Use case class
- Request/Response DTOs
- Validation logic
Dependency Injection Setup
Automatically configure dependency injection for generated modules:This adds service registrations to your DI container for all specified operations.
What Gets Registered
Rollback Support
Code generation includes automatic rollback capabilities:Generated Code Structure
When you generate a module named “Customer”, Chapi creates:Best Practices
Module Naming
Module Naming
- Use singular names (“Customer” not “Customers”)
- Use PascalCase
- Keep names concise and descriptive
- Avoid abbreviations unless widely understood
Operation Selection
Operation Selection
- Start with basic CRUD operations
- Add custom operations as needed
- Group related operations in the same module
- Use descriptive method names for custom operations
Code Review
Code Review
- Review generated code before committing
- Customize validation logic as needed
- Add business rules to domain layer
- Adjust DTOs to match your requirements
Database Configuration
Database Configuration
- Choose the correct database provider upfront
- Changing database provider later requires manual updates
- Ensure connection strings are configured
- Test repository methods after generation
Error Handling
Advanced Features
Custom Templates
Chapi uses Roslyn-based code generation, allowing customization of templates and patterns.
Batch Generation
Generate multiple modules simultaneously with semicolon-separated names.
Incremental Updates
Add endpoints to existing modules without regenerating everything.
Type Safety
All generated code is type-safe and follows C# best practices.
Related Features
Project Creation
Create projects with templates ready for code generation
AI Assistant
Use AI to suggest module structures and operations