MCAkbayir.XFramework.Generator.Tool
1.0.5
dotnet tool install --global MCAkbayir.XFramework.Generator.Tool --version 1.0.5
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local MCAkbayir.XFramework.Generator.Tool --version 1.0.5
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=MCAkbayir.XFramework.Generator.Tool&version=1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package MCAkbayir.XFramework.Generator.Tool --version 1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MCAkbayir.XFramework.Generator.Tool
CLI tool for automatic code generation in XFramework projects. Scaffolds a full CRUD stack from a single entity — DTOs, Mapper, Validators, Service, Controller, and DbSet — with one command.
🚀 Installation
dotnet tool install --global MCAkbayir.XFramework.Generator.Tool
📖 Usage
Run from your project directory (where the *.sln file is located):
# Generate all components for an entity
xgen Product
# Skip specific components
xgen Product --skip Mapper
xgen Product --skip Mapper,Validator
# Run via dotnet
dotnet xgen Order --skip Controller,DbSet
Available --skip values
Dto, Mapper, Validator, Service, Controller, DbSet
⚙️ Generated Components
| Component | Output Path | What Gets Generated |
|---|---|---|
| DTO | Dtos/{Entity}/ |
EntityDto, EntityAddDto, EntityUpdateDto |
| Mapper | BLL/Mappings/ |
AutoMapper Profile with reverse maps for all DTOs |
| Validator | BLL/Utilities/ValidationRulers/{Entity}/ |
FluentValidation AbstractValidator for AddDto & UpdateDto |
| Service | BLL/Services/Concretes/ |
EntityService extending BaseService with full CRUD |
| Controller | API/Controllers/ |
REST controller with GET, POST, PUT, DELETE endpoints |
| DbSet | DAL/{Project}Context.cs |
Adds DbSet<Entity> to your DbContext |
🔍 How It Works
- Builds DAL — Automatically runs
dotnet buildon your DAL project - Loads entity via reflection — Reads properties from the compiled assembly
- Filters audit fields — Excludes
CreatedAt,CreatedBy,UpdatedAt,UpdatedBy,IsActive,DeletedBy,DeletedAt,Revisionfrom DTOs - Generates code — Creates all selected component files in their correct locations
⚠️ Important Notes
- Validators are only generated for AddDto & UpdateDto — The base
EntityDtodoes not get a validator since it's used for read operations. Revisionproperty is added back to UpdateDto — Even though it's an audit field, it's included inUpdateDtofor concurrency control.Idis excluded from AddDto & UpdateDto — Only the baseEntityDtocontains theIdproperty.- Navigation properties and collections are excluded — Only value types, strings, and Guids are included in DTOs.
//Generated entitiescomment is required — TheDbSetgenerator looks for this comment in your DbContext to know where to insert. If missing, you'll need to add the DbSet manually.- DAL must build successfully — The tool runs
dotnet buildon your DAL project before generation. If it fails, no code will be generated.
📋 Requirements
- A
*.slnfile in the project root - Standard XFramework project structure: DAL, BLL, API, and Dtos projects
- A
//Generated entitiescomment in your DbContext for automatic DbSet insertion
📄 License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.