Getting started
Packages
| Package | Put it in | Contains |
|---|---|---|
Attritect.Contracts |
Domain (optional) | ISoftDelete, IFullAudited, … Interfaces only, no dependencies |
Attritect.Abstractions |
Application | The attributes, events, behaviors, page schema. Also brings the compile-time checks and generator |
Attritect.Core |
Application (only to override engine classes) | The engine: metadata, queries, mapping, the service pipeline |
Attritect.EntityFrameworkCore |
Infrastructure | The EF Core store |
Attritect.AspNetCore |
Api | The HTTP API, permissions from claims, tenant from the request |
Attritect.Permissions |
Infrastructure (optional) | Roles and permissions in your database, with pages to manage them |
Requires .NET 10. No third-party dependencies (only Microsoft’s own packages).
The smallest working app is the Minimal example in the Attritect.Examples repo: one project,
one [CrudPage] class over a SQLite table, under 100 lines in all.
A first page
// Entity (yours, any shape EF Core can map)
public class Nationality
{
public int Id { get; set; }
public string Name { get; set; } = "";
}
// Page model: what the API shows and accepts
[CrudPage("nationalities", Entity = typeof(Nationality), Title = "Nationalities", ItemTitle = "Nationality")]
public class NationalityModel
{
[Key, Grid(Title = "Code")]
public int Id { get; set; }
[Grid(Sortable = true), Search(Op.Contains), Field]
[Required, SafeText(100), Unique]
public string Name { get; set; } = "";
}
Wire it up
builder.Services.AddDbContext<AppDbContext>(o => o.UseSqlServer(connectionString));
builder.Services
.AddCrudEngine(o => o.AddPagesFrom(typeof(NationalityModel).Assembly))
.UseEntityFrameworkCore<AppDbContext>()
.AddHttpApi();
var app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();
app.MapCrudEngine();
That’s the whole page. You now have:
GET /api/crud/nationalities?f.name=sau&sort=name:asc&page=1&size=20
GET /api/crud/nationalities/5
POST /api/crud/nationalities {"name":"Saudi Arabia"}
PUT /api/crud/nationalities/5
DELETE /api/crud/nationalities/5
GET /api/crud/nationalities/schema (columns, fields, search, permissions: for any UI)
GET /api/crud/nationalities/unique/name?value=Saudi%20Arabia
GET /api/crud/pages (pages the caller may see)
Callers need permission claims (crud:nationalities:view, … or crud:*); see
Security. Without them the API answers 401/403.
What happens when you build
- The compile-time checks report mistakes in the editor (e.g.
Containssearch on a number, aDefaultSortfield that doesn’t exist). See Compile-time checks. - The generator writes
CrudPages.Nationality.Id,.Fields.Name,.Claims.View, and a page catalog so startup doesn’t scan your assemblies.
Next
- Pages and attributes for everything a page can declare.
- The examples repository for a complete Clean Architecture app with a Blazor admin UI.