The shared libraries every module composes against. Stable, opinionated, and designed for AI-assisted development with strict quality gates.
- 01/11
Core building block
Foundational domain primitives — Entity\<TId\>, AggregateRoot\<TId\>, Result\<T\>, DomainEvent, value objects, tenant abstractions, and the entire type hierarchy every module depends on.
- 02/11
Persistence building block
Multi-adapter persistence layer — SqlSugar (primary ORM with trim-clean query API), optional EF Core adapter, Dapper for read-only queries, all behind a unified IUnitOfWork abstraction.
- 03/11
Shared infrastructure building block
Cross-cutting infrastructure services — audit pipeline (channel queue + async writer), clock abstraction, seed framework (CSV-based), local file storage, and observability foundations.
- 04/11
Web / API pipeline building block
ASP.NET Core Minimal API pipeline — Mediator integration, Mapster object mapping, System.Text.Json source-generated serialization, Scalar OpenAPI, ProblemDetails error handling, and rate limiting.
- 05/11
Caching building block
In-memory caching with IMemoryCache — idempotency deduplication, rate limiting counters, and future FusionCache roadmap for multi-tier caching.
- 06/11
Eventing building block
CAP-based event-driven architecture — RabbitMQ transport, SQL Server Outbox for atomic publishing, integration event contracts, and the webhook delivery subsystem.
- 07/11
Eventing abstractions
Event abstractions layer — domain events, integration event contracts in SaaS.Contracts, the INotificationPublisher port, and the Null/CAP implementation pair.
- 08/11
Jobs building block
Quartz.NET background job scheduling — independent JobHost process, Cron-based scheduling, audit retention cleanup, and multi-instance safety.
- 09/11
Storage building block
File storage abstraction — IFileStorage port with LocalFileStorage default implementation, FileAssetService for upload/download/management, and future cloud storage adapter roadmap.
- 10/11
Mailing building block
Planned email/notification delivery infrastructure — currently handled through the INotificationDeliveryAdapter port with a Null default.
- 11/11
Quota building block
Usage quota management — PlatformBilling module with subscription-based entitlements, usage recording, quota checking, and over-quota enforcement policies.
What ships today
| Building Block | Purpose | Key Types |
|---|---|---|
| Domain | DDD primitives, Result pattern, entity interfaces, tenancy, domain events | Result<T>, EntityBase, TenantId, IAuditableEntity, ISoftDelete |
| Application | Mediator pipelines, authorization, tenancy resolution, audit sinks, caching | IAuthorizationDecisionService, ITenantResolver, IUnitOfWork, 7 pipeline behaviors |
| Infrastructure | ORM-agnostic implementations: auditing, clocking, caching, seeding, storage | AuditLoggerDispatcher, FusionCacheAppCache, LocalFileStorage, SeedRunner |
| Infrastructure.SqlSugar | Primary ORM adapter — trim-clean, CodeFirst, CSV seeding | SqlSugarUnitOfWork, SqlSugarAuditLogStore, CsvSeedStepBase<T> |
| Infrastructure.EfCore | Optional ORM adapter — IsTrimmable=false, same contract tests | BitzOrcasDbContext, EfCorePersistenceSchemaInitializer |
| Infrastructure.Dapper | Query-only adapter — lightweight read path | DapperAuditQueryPort |
| Infrastructure.Persistence.Models | Shared entity models consumed by all ORM adapters | EntityBase, BizEntityBase, TenantEntityBase, PersistenceModelRegistry |
| Modularity | Module governance — declaration, dependency graph, boundary verification | IAppModule, AppModuleRegistry, AppModuleDependencyGraph, AppModuleBoundaryVerifier |
| CodeGeneration.Abstractions | Code generation metadata model | IModuleDefinition, IAggregateDefinition, ICodeGenerator |
| CodeGeneration.Scriban | Scriban-based code generator with 13+ templates | Aggregate, domain event, command, handler, repository, endpoints templates |
Adapter pattern
All BuildingBlocks use a four-tier adapter strategy:
| Tier | Prefix | DI Registration | Purpose |
|---|---|---|---|
| Default | InMemory*, Null* | TryAddSingleton | API Shell, unit tests |
| Production | SqlSugar*, Local* | AddScoped (non-TryAdd) | Primary runtime, overrides Default |
| Optional | EfCore*, Dapper* | AddScoped | Switchable adapter, same contract tests |
| Unavailable | Unavailable* | TryAddSingleton | Fail-loud defaults |
Related
- Architecture overview — modular monolith + vertical slice patterns
- Architecture Diagrams — visual diagrams of the system
- ORM Adapter Pattern — detailed adapter switching diagram