NetSchema 3.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global NetSchema --version 3.0.1
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local NetSchema --version 3.0.1
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=NetSchema&version=3.0.1
                    
nuke :add-package NetSchema --version 3.0.1
                    

NetSchema - N-Tier Architecture Generator

NetSchema, .NET 8 proyektl?ri ���n avtomatik N-Tier arxitektura yaradan bir NuGet tool package-dir.

?? X�susiyy?tl?r

  • ? App.Core - Domain entities, interfaces v? base class-lar
  • ? App.DAL - Data Access Layer, DbContext, Repository Pattern
  • ? App.Business - Services, DTOs, Validators, AutoMapper
  • ? App.API - Controllers, Swagger, appsettings
  • ? App.Shared - Shared utilities v? interfaces
  • ? Automatic Code Generation - Modell?rinizd?n tam CRUD generate edir
  • ? Generic Repository implementasiyas? (CRUD + Soft Delete)
  • ? Entity-specific repository-l?r ���n haz?r struktur
  • ? Soft delete d?st?yi (IsDeleted flag)
  • ? Audit fields (CreatedDate, UpdatedDate, IsDeleted)
  • ? AutoMapper konfiqurasiyas?
  • ? FluentValidation inteqrasiyas?
  • ? Sample Controller v? DTO-lar

?? Qura?d?rma

Global Tool olaraq

dotnet tool install --global NetSchema

Local Tool olaraq (proyekt ���n)

dotnet new tool-manifest # ?g?r yoxdursa
dotnet tool install NetSchema

?? ?stifad?

Option 1: ?lkin Struktur Yaratmaq (First Time Setup)

Solution directory-nizd? (.sln fayl?n?n oldu?u qovluqda) a?a??dak? ?mri i?l?din:

dotnet netschema generate

Bu ?mr avtomatik olaraq tam N-Tier strukturu yaradacaq (App.Core, App.DAL, App.Business, App.API, App.Shared).


Option 2: M�vcud Modell?r ���n Kod Generate Etm?k ? NEW!

?g?r art?q strukturunuz varsa v? yeni entity-l?r ���n kod generate etm?k ist?yirsinizs?:

1. Entity-l?rinizi yarad?n
// App.Core/Entities/User.cs
public class User : BaseEntity, IAuditedEntity
{
    public string FullName { get; set; } = string.Empty;
    public string Email { get; set; } = string.Empty;
    public DateTime DateOfBirth { get; set; }
    public bool IsActive { get; set; }
    public DateTime CreatedDate { get; set; }
    public DateTime? UpdatedDate { get; set; }
    public bool IsDeleted { get; set; }
}

// App.Core/Entities/Product.cs
public class Product : BaseEntity, IAuditedEntity
{
    public string Name { get; set; } = string.Empty;
    public string? Description { get; set; }
    public decimal Price { get; set; }
    public int StockQuantity { get; set; }
    public DateTime CreatedDate { get; set; }
    public DateTime? UpdatedDate { get; set; }
    public bool IsDeleted { get; set; }
}
2. Code Generator Console App yarad?n
dotnet new console -n MyApp.CodeGen
cd MyApp.CodeGen
dotnet add reference ../MyApp.Core/MyApp.Core.csproj
dotnet add package NetSchema
3. NetSchema il? kod generate edin
// MyApp.CodeGen/Program.cs
using NetSchema.Core;
using MyApp.Core.Entities;

// Fluent API (T�vsiy? olunur)
NetSchema.Configure()
    .AddEntity<User>()
    .AddEntity<Product>()
    .AddEntity<Order>()
    .GenerateAll();

// v? ya Sad? API
// NetSchema.Generate(typeof(User), typeof(Product), typeof(Order));
4. Generate edin!
dotnet run

?? N? Generate Olur?

? Her bir entity ���n avtomatik yarad?r:

?? DTOs (3x)
   � UserDto.cs
   � CreateUserDto.cs
   � UpdateUserDto.cs

? Validators (2x)
   � CreateUserValidator.cs
   � UpdateUserValidator.cs

??? Repositories (2x)
   � IUserRepository.cs
   � UserRepository.cs

?? Services (2x)
   � IUserService.cs
   � UserService.cs

?? Controllers (1x)
   � UserController.cs (Full CRUD REST API)

?? Plus:
   � DbContext-? DbSet ?lav? edir
   � AutoMapper mapping-l?r
   � DI registration-lar

?? Advanced Options

Skip specific generators

NetSchema.Configure()
    .AddEntity<User>()
    .AddEntity<Product>()
    .SkipControllers()  // Controller-l?ri yaratma
    .SkipServices()     // Service-l?ri yaratma
    .GenerateAll();

Custom output path

NetSchema.Configure()
    .AddEntity<User>()
    .WithOutputPath("./CustomOutput")
    .GenerateAll();

Custom namespace

NetSchema.Configure()
    .AddEntity<User>()
    .WithNamespace("MyCompany.MyApp")
    .GenerateAll();

?? Generated API Examples

Generate olunduqdan sonra tam funksional REST API endpoint-l?riniz olacaq:

# Get all users
GET /api/user

# Get user by id
GET /api/user/1

# Create new user
POST /api/user
{
  "fullName": "John Doe",
  "email": "john@example.com",
  "dateOfBirth": "1990-01-01",
  "isActive": true
}

# Update user
PUT /api/user/1
{
  "id": 1,
  "fullName": "John Updated",
  "email": "john.updated@example.com",
  "dateOfBirth": "1990-01-01",
  "isActive": true
}

# Delete user (soft delete)
DELETE /api/user/1

?? Connection String

App.API/appsettings.json fayl?nda database connection string-ini d�z?ldin:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Database=YourDb;User Id=sa;Password=yourpassword;TrustServerCertificate=True"
  }
}

??? Migration

cd App.API
dotnet ef migrations add InitialCreate
dotnet ef database update

?? API-ni i?? sal?n

dotnet run

Swagger UI: https://localhost:5001/swagger


?? N�mun?l?r

USAGE.md fayl?nda tam n�mun?l?r v? daha �ox detallar.

?? T�hf? verm?k

Pull request-l?r xo? qar??lan?r! B�y�k d?yi?iklikl?r ���n ?vv?lc? issue a�?n.

?? Lisenziya

MIT

?? M�?llif

Emil - GitHub

?? Problem bildirm?k

GitHub Issues

?? N�vb?ti Versiyalarda

  • Fluent API for code generation ? v3.0.0
  • JWT Authentication
  • Redis Caching
  • Logging (Serilog)
  • Unit Test layer
  • Docker support
  • GraphQL support
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.

Version Downloads Last Updated
3.0.3 186 11/4/2025
3.0.2 174 11/4/2025
3.0.1 188 10/29/2025
3.0.0 164 10/29/2025
1.0.0 175 4/22/2025

Version 3.0.1 - Quick Release (Unsigned):
🚀 Same features as 3.0.0 but with faster NuGet indexing
🚀 Fluent API for code generation from existing entities
🚀 Automatic DTO, Validator, Repository, Service, Controller generation
🚀 Smart validation rules based on property types
🚀 AutoMapper configuration generation
🚀 Dependency Injection auto-registration
✅ Enhanced: DbContext auto-update with DbSets
✅ Enhanced: Better error handling and logging
✅ Complete N-Tier architecture with 5 layers
✅ Soft delete support with query filters
✅ Repository pattern with ExistsAsync and CountAsync
✅ Connection retry strategy and CORS support

Note: This is an unsigned package for faster NuGet indexing.