ZenithArch.Generator 1.0.0

dotnet add package ZenithArch.Generator --version 1.0.0
                    
NuGet\Install-Package ZenithArch.Generator -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZenithArch.Generator" Version="1.0.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZenithArch.Generator" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ZenithArch.Generator">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZenithArch.Generator --version 1.0.0
                    
#r "nuget: ZenithArch.Generator, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ZenithArch.Generator@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZenithArch.Generator&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ZenithArch.Generator&version=1.0.0
                    
Install as a Cake Tool

Zenith Arch

Compile-time architecture automation for .NET with Roslyn incremental source generation.

NuGet ZenithArch.Abstractions NuGet ZenithArch.Generator NuGet ZenithArch.Cli

Installation

dotnet add package ZenithArch.Abstractions
dotnet add package ZenithArch.Generator

For source generator usage, configure analyzer-style reference:

<ItemGroup>
  <PackageReference Include="ZenithArch.Abstractions" Version="1.0.8" />
  <PackageReference Include="ZenithArch.Generator" Version="1.0.8" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>

Optional CLI installation:

dotnet tool install --global ZenithArch.Cli --version 1.0.8

Quickstart

using ZenithArch.Abstractions.Attributes;
using ZenithArch.Abstractions.Enums;

[assembly: Architecture(
    Profile = ArchitectureProfile.CqrsQuickStart,
    Pattern = ArchitecturePattern.Cqrs,
    GenerateDependencyInjection = true,
    DbContextType = typeof(AppDbContext)
)]

namespace Demo.Domain;

[Entity]
public partial class Trip
{
    public Guid Id { get; set; }

    [Required]
    [MinLength(3)]
    [MaxLength(120)]
    public string Name { get; set; } = string.Empty;
}

Build once:

dotnet build

Then register generated DI extensions:

builder.Services.AddZenithArchDependencies();

Full API Reference

ZenithArch.Abstractions.Attributes

  • ArchitectureAttribute: Assembly-level generation contract (pattern, profile, feature flags).
    • Example: [assembly: Architecture(Pattern = ArchitecturePattern.Cqrs, GenerateDependencyInjection = true)]
  • EntityAttribute: Marks a class as a generation candidate entity.
    • Example: [Entity] public partial class Trip { }
  • AggregateRootAttribute: Marks an entity as an aggregate root for domain-event-enabled generation.
    • Example: [Entity, AggregateRoot] public partial class Order : EntityBase { }
  • MapToAttribute: Declares DTO/view model mapping targets.
    • Example: [MapTo(typeof(TripDto))] public partial class Trip : EntityBase { }
  • QueryFilterAttribute: Marks properties as generated filter criteria.
    • Example: [QueryFilter] public string? Name { get; set; }
  • RequiredAttribute: Marks a property as required for generated validators.
    • Example: [Required] public string Name { get; set; } = string.Empty;
  • MinLengthAttribute: Declares minimum length validation.
    • Example: [MinLength(3)] public string Name { get; set; } = string.Empty;
  • MaxLengthAttribute: Declares maximum length validation.
    • Example: [MaxLength(120)] public string Name { get; set; } = string.Empty;
  • EmailAttribute: Marks a property for email-format validation.
    • Example: [Email] public string ContactEmail { get; set; } = string.Empty;

ZenithArch.Abstractions.Enums

  • ArchitecturePattern: Selects CQRS, Repository, or FullStack generation topology.
    • Example: Pattern = ArchitecturePattern.FullStack
  • ArchitectureProfile: Applies starter flag presets.
    • Example: Profile = ArchitectureProfile.RepositoryQuickStart
  • CqrsSaveMode: Controls write persistence timing.
    • Example: CqrsSaveMode = CqrsSaveMode.PerRequestTransaction

ZenithArch.Abstractions.Interfaces

  • IAggregateRoot: Aggregate marker with domain-event buffer contract.
    • Example: public partial class Order : EntityBase, IAggregateRoot { }
  • IDomainEvent: Domain event contract with occurrence timestamp.
    • Example: public sealed record TripCreated(Guid TripId) : DomainEvent;
  • IAuditable: Audit metadata contract.
    • Example: public DateTime CreatedAt { get; set; }
  • ISoftDelete: Soft-delete contract.
    • Example: public bool IsDeleted { get; set; }
  • ISpecification<T>: Query specification contract.
    • Example: public Expression<Func<Trip, bool>>? Criteria { get; }
  • ISecurityContext: User/tenant context abstraction.
    • Example: public string? UserId => _http.User.Identity?.Name;
  • IZenithArchExecutionObserver: Runtime observer hooks for telemetry.
    • Example: public void OnValidationFailed(string requestName, int failureCount) { ... }

ZenithArch.Abstractions.Base

  • EntityBase: Aggregate base type with Id, domain event buffering, and clear operations.
    • Example: public partial class Trip : EntityBase { }
  • DomainEvent: Base immutable domain event record.
    • Example: public sealed record TripUpdated(Guid TripId) : DomainEvent;

Configuration

ArchitectureAttribute options

Option Type Default Valid values
Profile ArchitectureProfile Custom Custom, CqrsQuickStart, RepositoryQuickStart, FullStackQuickStart
Pattern ArchitecturePattern Cqrs Cqrs, Repository, FullStack
UseSpecification bool false true / false
UseUnitOfWork bool false true / false
EnableValidation bool false true / false
GenerateDependencyInjection bool false true / false
GenerateEndpoints bool false true / false
EnableExperimentalEndpoints bool false true / false
GenerateDtos bool false true / false
GenerateEfConfigurations bool false true / false
GenerateCachingDecorators bool false true / false
GeneratePagination bool false true / false
DbContextType Type? null Any DbContext type
CqrsSaveMode CqrsSaveMode PerHandler PerHandler, PerRequestTransaction

Feature dependency expectations

  • CQRS or FullStack generation: MediatR
  • Validation generation: FluentValidation
  • Persistence generation: Microsoft.EntityFrameworkCore
  • Endpoint generation: Microsoft.AspNetCore.App
  • Caching decorators: Microsoft.Extensions.Caching.*

Versioning Policy

Zenith Arch follows SemVer (MAJOR.MINOR.PATCH).

  • Breaking public API changes require a major version bump.
  • New backward-compatible capabilities use a minor version bump.
  • Backward-compatible fixes and process improvements use a patch bump.

Full change history: CHANGELOG.md

Contributing

Issues and pull requests are welcome.

  1. Open an issue with repro steps and expected behavior.
  2. Fork and create a feature branch.
  3. Add tests for behavior changes.
  4. Submit a pull request with changelog updates.

Contribution guidelines: CONTRIBUTING.md

License

MIT. See LICENSE.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has 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.

Version Downloads Last Updated
1.0.0 99 4/26/2026

ZenithArch 1.0.0: migration baseline for standardized NuGet process, SemVer governance, XML API docs, characterization tests, and CI tag-based publishing. Full changelog: https://github.com/tuanngp/ZenithArch/blob/main/CHANGELOG.md