Modulytics.Blueprints
1.0.1
See the version list below for details.
dotnet new install Modulytics.Blueprints::1.0.1
📦 Modulytics Blueprints
DDD • Modular • Clean Architecture • CRUD Templates for .NET 9
Modulytics Blueprints нь .NET 9 дээр DDD + Modular Monolith архитектур ашиглан хурдан хөгжүүлэлт хийхэд зориулагдсан dotnet new template-үүдийн багц юм.
Эдгээр template-үүдийг ашигласнаар та шинэ модуль, aggregate, CRUD endpoint, domain layer, integration events болон бүрэн module scaffolding-ийг секундүүдийн дотор үүсгэж чадна.
🚀 Install
NuGet дээрээс нэг командоор суулгана:
dotnet new install Modulytics.Blueprints
Хэрвээ өмнөх хувилбар суусан бол:
dotnet new uninstall Modulytics.Blueprints
dotnet new install Modulytics.Blueprints
📂 Included Templates
Доорх template-үүд dotnet new list дээр харагдана:
| Template | Short Name | Description |
|---|---|---|
| Module Template | ml-module |
Шинэ DDD модуль scaffold үүсгэнэ: Application, Domain, Endpoints, Infrastructure, Persistence, IntegrationEvents зэрэг үндсэн хавтасууд |
| Feature Template | ml-feature |
Нэг aggregate root бүхий feature-ийг бүрэн scaffold хийнэ: Entity + DomainEvents + Repository + CQRS (Commands/Queries) + IntegrationEvents + Endpoints |
Жич: Template бүр .template.config-ийн symbol-уудаар entity/module нэрийг автоматаар солигдуулна.
🛠 Usage
1️⃣ Module үүсгэх
dotnet new ml-module -n Products
<sub>Дээрх команд нь Products нэртэй бүрэн DDD модуль scaffold үүсгэнэ.</sub>
Үүсэх structure:
/src/Modules/Products
├── Modules.Products.Application
│ ├── AssemblyReference.cs
│ └── Modules.Products.Application.csproj
│
├── Modules.Products.Domain
│ ├── IUnitOfWork.cs
│ └── Modules.Products.Domain.csproj
│
├── Modules.Products.Endpoints
│ ├── AssemblyReference.cs
│ ├── ProductsPermissions.cs
│ └── Modules.Products.Endpoints.csproj
│
├── Modules.Products.Infrastructure
│ ├── BackgroundJobs
│ │ ├── ProcessInboxMessages
│ │ │ ├── IntegrationEventHandlerFactory.cs
│ │ │ ├── ProcessInboxMessagesConfiguration.cs
│ │ │ ├── ProcessInboxMessagesJob.cs
│ │ │ └── ProcessInboxMessagesOptions.cs
│ │ └── ProcessOutboxMessages
│ │ ├── ProcessOutboxMessagesConfiguration.cs
│ │ ├── ProcessOutboxMessagesJob.cs
│ │ └── ProcessOutboxMessagesOptions.cs
│ │
│ ├── Consumers
│ │ └── ConsumerConfiguration.cs
│ │
│ ├── Idempotence
│ │ ├── IdempotentDomainEventHandler.cs
│ │ ├── IdempotentIntegrationEventHandler.cs
│ │ └── IntegrationEventConsumer.cs
│ │
│ ├── ServiceInstallers
│ │ ├── ApplicationServiceInstaller.cs
│ │ ├── BackgroundJobsServiceInstaller.cs
│ │ ├── EndpointsServiceInstaller.cs
│ │ ├── PersistenceServiceInstaller.cs
│ │ ├── ProcessInboxMessagesOptionsSetup.cs
│ │ └── ProcessOutboxMessagesOptionsSetup.cs
│ │
│ ├── AssemblyReference.cs
│ ├── ProductsModuleInstaller.cs
│ └── Modules.Products.Infrastructure.csproj
│
├── Modules.Products.IntegrationEvents
│ └── Modules.Products.IntegrationEvents.csproj
│
└── Modules.Products.Persistence
├── Configurations
│ ├── InboxMessageConfiguration.cs
│ ├── InboxMessageConsumerConfiguration.cs
│ ├── OutboxMessageConfiguration.cs
│ └── OutboxMessageConsumerConfiguration.cs
│
├── Constants
│ ├── Schemas.cs
│ └── TableNames.cs
│
├── AssemblyReference.cs
├── ProductsDbContext.cs
├── UnitOfWork.cs
└── Modules.Products.Persistence.csproj
2️⃣ Feature нэмэх
dotnet new ml-feature -n Brand \
--Module Products \
--Entity Brand \
--entity brand \
--Entities Brands \
--entities brands \
--schema products \
--table brands \
--EntityMN "Бренд" \
--EntityMNiin "Брендын" \
--EntityMNiig "Брендыг" \
--entityMN "бренд" \
--entityMNiin "брендын" \
--entityMNiig "брендыг"
Үүсэх файлууд:
/src/Modules/Products
├── Modules.Products.Application
│ ├── Brands
│ │ ├── CreateBrand
│ │ │ ├── CreateBrandCommand.cs
│ │ │ ├── CreateBrandCommandHandler.cs
│ │ │ ├── CreateBrandCommandValidator.cs
│ │ │ └── BrandCreatedDomainEventHandler.cs
│ │ │
│ │ ├── DeleteBrand
│ │ │ ├── DeleteBrandCommand.cs
│ │ │ ├── DeleteBrandCommandHandler.cs
│ │ │ └── DeleteBrandCommandValidator.cs
│ │ │
│ │ ├── GetBrandById
│ │ │ ├── GetBrandByIdQuery.cs
│ │ │ ├── GetBrandByIdQueryHandler.cs
│ │ │ └── BrandResponse.cs
│ │ │
│ │ ├── GetBrands
│ │ │ ├── GetBrandsQuery.cs
│ │ │ ├── GetBrandsQueryHandler.cs
│ │ │ └── BrandResponse.cs
│ │ │
│ │ ├── RestoreBrand
│ │ │ ├── RestoreBrandCommand.cs
│ │ │ ├── RestoreBrandCommandHandler.cs
│ │ │ └── RestoreBrandCommandValidator.cs
│ │ │
│ │ └── UpdateBrand
│ │ ├── UpdateBrandCommand.cs
│ │ ├── UpdateBrandCommandHandler.cs
│ │ ├── UpdateBrandCommandValidator.cs
│ │ └── BrandChangedDomainEventHandler.cs
│ │
│ ├── ValidationErrors
│ │ ├── BrandValidationErrors.cs
│ │ └── (other validation errors…)
│ │
│ └── (other application features…)
│
├── Modules.Products.Domain
│ ├── Brands
│ │ ├── Events
│ │ │ ├── BrandCreatedDomainEvent.cs
│ │ │ └── BrandUpdatedDomainEvent.cs
│ │ │
│ │ ├── Brand.cs
│ │ ├── BrandId.cs
│ │ ├── BrandErrors.cs
│ │ └── IBrandRepository.cs
│ │
│ └── (other domain features…)
│
├── Modules.Products.Endpoints
│ ├── Contracts
│ │ ├── Brands
│ │ │ ├── CreateBrandRequest.cs
│ │ │ ├── GetBrandsRequest.cs
│ │ │ ├── UpdateBrandRequest.cs
│ │ │ └── UpdateBrandRequestContent.cs
│ │ │
│ │ └── (other contract features…)
│ │
│ ├── Brands
│ │ ├── CreateBrandEndpoint.cs
│ │ ├── DeleteBrandEndpoint.cs
│ │ ├── GetBrandByIdEndpoint.cs
│ │ ├── GetBrandsEndpoint.cs
│ │ ├── RestoreBrandEndpoint.cs
│ │ └── UpdateBrandEndpoint.cs
│ │
│ ├── Routes
│ │ ├── BrandsRoutes.cs
│ │ └── (other routes…)
│ │
│ └── (other endpoint features…)
│
├── Modules.Products.IntegrationEvents
│ ├── Brands
│ │ ├── BrandCreatedIntegrationEvent.cs
│ │ └── BrandChangedIntegrationEvent.cs
│ │
│ └── (other integration event features…)
│
└── Modules.Products.Persistence
├── Configurations
│ ├── BrandConfiguration.cs
│ └── (other configurations…)
│
└── Repositories
├── BrandRepository.cs
└── (other repositories…)
🔧 Parameters
Template бүр дараах parameters-ыг дэмждэг:
| Parameter | Description | Example |
|---|---|---|
--Module |
Module name (PascalCase) | Products |
--Entity |
Entity name (PascalCase) | Brand |
--entity |
Entity name (camelCase) | brand |
--Entities |
Plural (PascalCase) | Brands |
--entities |
Plural (camelCase) | brands |
--schema |
Schema (snake_case) | products |
--table |
Table (snake_case) | brands |
--EntityMN |
Монгол нэр (эхний үсэг томоор) | Бренд |
--EntityMNiin |
Монгол нэр (эхний үсэг томоор, *-ын/ийн) | Брендын |
--EntityMNiig |
Монгол нэр (эхний үсэг томоор, *-ыг/ийг) | Брендыг |
--entityMN |
Монгол нэр (жижигээр) | бренд |
--entityMNiin |
Монгол нэр (жижигээр, *-ын/ийн/ны/ний) | брендын |
--entityMNiig |
Монгол нэр (жижигээр, *-ыг/ийг/г) | брендыг |
Жишээ:
dotnet new ml-module -n Orders
dotnet new ml-feature -n OrderItem \
--Module Orders \
--Entity OrderItem \
--entity orderItem \
--Entities OrderItems \
--entities orderItems \
--schema orders \
--table order_items \
--EntityMN "Захиалгын бараа" \
--EntityMNiin "Захиалгын барааны" \
--EntityMNiig "Захиалгын барааг" \
--entityMN "захиалгын бараа" \
--entityMNiin "захиалгын барааны" \
--entityMNiig "захиалгын барааг"
🧱 Folder Structure (Template Pack)
blueprints/
│
├── templates/
│ ├── feature/
│ │ ├── .template.config/template.json
│ │ └── src/Modules/__Module__/...
│ └── module/
│ ├── .template.config/template.json
│ └── src/Modules/__Module__/...
│
└── Blueprints.csproj
Blueprints.csproj нь template-үүдийг compile хийхгүй, зөвхөн content/ folder руу багцалдаг.
🔄 Update Template Pack
Version өсгөнө:
<Version>1.0.1</Version>
Package дахин үүсгэнэ:
dotnet pack -c Release -o ./nupkgs
NuGet руу push:
dotnet nuget push ./nupkgs/Modulytics.Blueprints.1.0.1.nupkg \
--source https://api.nuget.org/v3/index.json
--api-key YOUR_KEY \
--skip-duplicate
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.