Generators
Ninjadog includes 59 generators organized into 16 categories. Each generator produces either a single shared file or a per-entity file.
Generator Overview
| Category | Generators | Scope |
|---|---|---|
| Project Setup | ProgramGenerator, AppSettingsGenerator, IndexPageGenerator, DomainEntityGenerator | Single file / Per entity |
| Domain | DomainEntityGenerator, EnumGenerator | Per entity |
| Core | NinjadogGenerator | Single file |
| Contracts – Data | DtoGenerator | Per entity |
| Contracts – Requests | Create, Delete, Get, Update | Per entity |
| Contracts – Responses | GetAllResponse, Response | Per entity |
| Database | DatabaseInitializer, DbConnectionFactory | Single file |
| Endpoints | Create, Delete, GetAll, Get, Update | Per entity |
| Mapping | ApiContract-to-Domain, Domain-to-ApiContract, Domain-to-Dto, Dto-to-Domain | Single file |
| Repositories | Repository, RepositoryInterface | Per entity |
| Services | Service, ServiceInterface | Per entity |
| Summaries | Create, Delete, GetAll, Get, Update | Per entity |
| Validation | CreateRequestValidator, UpdateRequestValidator | Per entity |
| Middleware | RequestCorrelationMiddleware | Single file |
| Docker | Dockerfile, DockerCompose, DockerIgnore | Single file |
| Integration Tests | TestCsproj, WebApplicationFactory, TestBase, EntityEndpointTests | Single file / Per entity |
Generation Modes
- Single File – One file generated regardless of how many entities exist (e.g., the database initializer creates tables for all entities in one file)
- Per Entity – One file per entity defined in
ninjadog.json(e.g., each entity gets its own repository, service, and endpoints)
All generated classes are
partial, so you can extend them with custom logic without modifying generated code.
Next Steps
- Configuration Reference – Define entities, enums, and features in ninjadog.json
- Generated Examples – See real generated code from snapshot tests
- Seed Data Generator – Populate tables with initial data at startup
- CLI Reference – Run the generators from the command line