Skip to the content.

Attritect packages: what each does, what you need

Version 0.2.0. The dependencies below are taken from the built packages.

How they fit together

Attritect.Contracts        Attritect.Abstractions
 (interfaces only)          (attributes, schema)
            \                  /
             Attritect.Core  (the engine)
              /                   \
Attritect.EntityFrameworkCore   Attritect.AspNetCore
 (saves to the database)         (HTTP API)
          |
Attritect.Permissions
 (roles in the database)

When you install a package, NuGet brings the ones above it automatically.

Why six packages for four layers?

Packages aren’t layers. They are split by what each layer may depend on, which is the core rule of Clean Architecture. Four of them match the four layers; the other two have different jobs.

Layer Package Why it’s separate
Domain Attritect.Contracts The Domain must depend on almost nothing: two interfaces, no logic, no dependencies
Application Attritect.Abstractions Pages are described here with attributes, without depending on EF Core or ASP.NET Core
Infrastructure Attritect.EntityFrameworkCore All database code stays in this layer
Web/API Attritect.AspNetCore All HTTP code stays at the outer edge

The other two:

One big package would make the Domain and Application layers reference EF Core and ASP.NET Core, breaking Clean Architecture from the start. The CleanArchitecture example has architecture tests that fail the build when a layer references the wrong package. See also Clean Architecture.

The free packages (MIT)

Package What it does Needed? Goes in
Attritect.Abstractions The attributes you write ([CrudPage], [Grid], [Field], [Search], [Lookup]…), page events, the page schema, plus the compile-time checks (CRUD001–017) and the generator for CrudPages.* names. Required. You can’t describe a page without it. Application (page models)
Attritect.Core The engine: reads the attributes, builds queries (search, sort, paging, translated to SQL), maps entity ↔ model, validates, runs the create/update/delete pipeline, isolates tenants. Required, but it comes with EntityFrameworkCore or AspNetCore. Reference it directly only to override engine classes. Pulled in automatically
Attritect.EntityFrameworkCore The database store: runs the queries through your EF Core DbContext, saves rows, handles transactions, soft-delete filters and audit fields. .UseEntityFrameworkCore<AppDbContext>() Required in practice: the engine needs somewhere to store data. Infrastructure
Attritect.AspNetCore The HTTP API at /api/crud/{page}: list, get, create, update, delete, schema, lookups, unique-checks. Permissions come from the user’s claims, the tenant from the request. .AddHttpApi() + app.MapCrudEngine() Required for a web app or API. Not needed if you only call ICrudService from code (e.g. a background job). Web / API
Attritect.Contracts Interfaces only (ISoftDelete, IFullAudited), no logic, no dependencies, so Domain entities can be soft-deletable and audited without depending on the engine. Optional. For automatic soft delete and created/modified/deleted fields. Domain
Attritect.Permissions Roles and permissions in your database, with admin pages: Roles, Role permissions, User roles. .UseDatabasePermissions<AppDbContext>() + .AddPermissionPages() Optional. Without it, permissions come only from claims (crud:{page}:view…). Infrastructure

The Pro packages (paid, all optional)

Package What it does
Attritect.Pro.Ui.Blazor Admin screens: every page at /admin/{page} (grid, search, add/edit forms, lookups, master-detail, right to left, Hijri dates) with no markup to write.
Attritect.Pro.Audit + .Audit.AspNetCore History: who changed what and when, in the same transaction; per-row history, deleted items, restore any version.
Attritect.Pro.ImportExport + .ImportExport.AspNetCore Excel and CSV: export any page, import with a check-first report.
Attritect.Pro.TenantDatabases Tools for giving tenants their own databases.
Attritect.Pro.Licensing Checks the license key. Comes with the others; never installed alone.
Attritect.Pro.All All of the above in one reference.

What to install

Smallest web API (the Minimal example): Attritect.EntityFrameworkCore + Attritect.AspNetCore. Core, Abstractions and Contracts come with them.

Clean Architecture app (like the CleanArchitecture example):

Project Packages
Domain Attritect.Contracts (optional)
Application Attritect.Abstractions (+ Attritect.Core only to override engine classes)
Infrastructure Attritect.EntityFrameworkCore (+ Attritect.Permissions, optional)
Web Attritect.AspNetCore (+ Attritect.Pro.All for the admin UI, history and Excel)

Rule of thumb