ZenithArch.Cli 1.0.0

dotnet tool install --global ZenithArch.Cli --version 1.0.0
                    
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 ZenithArch.Cli --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=ZenithArch.Cli&version=1.0.0
                    
nuke :add-package ZenithArch.Cli --version 1.0.0
                    

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.

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 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 is compatible.  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
1.0.0 102 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