Clean Architecture
The packages are split so each layer takes only what it needs. The main example (examples repository,
CleanArchitecture/) follows this and enforces it with architecture tests.
SampleApp.Domain → Attritect.Contracts (optional: ISoftDelete, IFullAudited; interfaces only)
SampleApp.Application → Domain + Attritect.Abstractions (+ .Core only to override engine classes)
SampleApp.Infrastructure → Application + Attritect.EntityFrameworkCore
SampleApp.Api → Infrastructure + Attritect.AspNetCore
| Layer | Holds | Never references |
|---|---|---|
| Domain | Entities | anything but Contracts |
| Application | [CrudPage] models, page events, handlers, behaviors, (service/mapper overrides) |
EF Core, ASP.NET Core |
| Infrastructure | DbContext, EF configurations, migrations, ApplyCrudConventions |
ASP.NET Core |
| Api | Composition root: auth, AddCrudEngine, MapCrudEngine |
// Api/Program.cs
builder.Services
.AddCrudEngine(o => o.AddPagesFrom(SampleApp.Application.DependencyInjection.Assembly).UseMultiTenancy<int>())
.UseEntityFrameworkCore<AppDbContext>()
.AddHttpApi(o => o.HostRole = "admin");
Strict or pragmatic: Application referencing only Abstractions keeps every rule in events, handlers and
behaviors; adding Core allows overriding service steps. Pick per team; both are supported.
Database-first works the same: scaffold entities into Infrastructure (or Domain) and point pages at them; see
the examples’ DatabaseFirst/.