FastCrud.Abstractions
0.2.1
See the version list below for details.
dotnet add package FastCrud.Abstractions --version 0.2.1
NuGet\Install-Package FastCrud.Abstractions -Version 0.2.1
<PackageReference Include="FastCrud.Abstractions" Version="0.2.1" />
<PackageVersion Include="FastCrud.Abstractions" Version="0.2.1" />
<PackageReference Include="FastCrud.Abstractions" />
paket add FastCrud.Abstractions --version 0.2.1
#r "nuget: FastCrud.Abstractions, 0.2.1"
#:package FastCrud.Abstractions@0.2.1
#addin nuget:?package=FastCrud.Abstractions&version=0.2.1
#tool nuget:?package=FastCrud.Abstractions&version=0.2.1
🚀 FastCrud — Minimal API CRUD Generator for .NET 9
FastCrud is a lightweight, flexible CRUD API generator for .NET 9.
It combines Minimal APIs + EF Core + DTOs + FluentValidation + Gridify + Auto-Swagger to let you bootstrap production-ready endpoints with minimal effort.
📦 Install NuGet packages
Add the required FastCrud packages (version 0.2.1
):
dotnet add package FastCrud.Abstractions -v 0.2.1
dotnet add package FastCrud.Core -v 0.2.1
dotnet add package FastCrud.Mapping.Mapster -v 0.2.1
dotnet add package FastCrud.PersistenceEfCore -v 0.2.1
dotnet add package FastCrud.Query.Gridify -v 0.2.1
dotnet add package FastCrud.Validation.FluentValidation -v 0.2.1
dotnet add package FastCrud.Web.MinimalApi -v 0.2.1
⚙️ Configure Program.cs
Register FastCrud services:
builder.Services.AddFastCrudCore();
builder.Services.UseMapster();
builder.Services.UseGridifyQueryEngine();
builder.Services.UseFluentValidationAdapter();
Register EF repositories per entity:
builder.Services.AddEfRepository<Customer, Guid, AppDbContext>();
builder.Services.AddEfRepository<Order, Guid, AppDbContext>();
🌐 Map CRUD Endpoints
Define CRUD endpoints for each entity + DTO set:
app.MapFastCrud<Customer, Guid, CustomerCreateDto, CustomerUpdateDto, CustomerReadDto>(
"/api/customers",
nameof(Customer),
"v1"
);
app.MapFastCrud<Order, Guid, OrderCreateDto, OrderUpdateDto, OrderReadDto>(
"/api/orders",
nameof(Order),
"v1",
~CrudOps.Delete // disable Delete
);
- Each entity requires 3 DTOs: CreateDto, UpdateDto, and ReadDto.
- By default, all CRUD operations are generated.
- To restrict operations, use the CrudOps flag with bitwise operators.
✅ Validation
Add FluentValidation validators for your DTOs or entities:
public class CustomerValidator : AbstractValidator<Customer>
{
public CustomerValidator()
{
RuleFor(x => x.FirstName).NotEmpty().WithMessage("First name is required.");
RuleFor(x => x.LastName).NotEmpty();
RuleFor(x => x.Email).NotEmpty().EmailAddress();
}
}
Validation is applied automatically to requests.
🔍 Filtering & Sorting with Gridify
Enable advanced query options by writing a Gridify
profile:
public sealed class CustomerGridifyProfile : IGridifyMapperProfile<Customer>
{
public void Configure(GridifyMapper<Customer> m)
{
m.Configuration.CaseInsensitiveFiltering = true;
m.GenerateMappings()
.AddMap("name", c => c.FirstName + " " + c.LastName)
.RemoveMap(nameof(Customer.CreatedUtc));
}
}
This enables expressive queries like:
GET /api/customers?filter=name~"john"&sort=-CreatedUtc&page=1&pageSize=20
🎉 Done!
With just a few lines, you get:
- Clean Minimal APIs
- Automatic Swagger docs
- DTO mapping (Mapster)
- Validation (FluentValidation)
- Filtering, sorting & paging (Gridify)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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. |
-
net9.0
- No dependencies.
NuGet packages (6)
Showing the top 5 NuGet packages that depend on FastCrud.Abstractions:
Package | Downloads |
---|---|
FastCrud.Core
Fast and flexible CRUD API generator for .NET 9: minimal API + EF Core with DTOs, FluentValidation, paging, filtering, sorting and auto‑Swagger |
|
FastCrud.Mapping.Mapster
Fast and flexible CRUD API generator for .NET 9: minimal API + EF Core with DTOs, FluentValidation, paging, filtering, sorting and auto‑Swagger |
|
FastCrud.Query.Gridify
Fast and flexible CRUD API generator for .NET 9: minimal API + EF Core with DTOs, FluentValidation, paging, filtering, sorting and auto‑Swagger |
|
FastCrud.Web.MinimalApi
Fast and flexible CRUD API generator for .NET 9: minimal API + EF Core with DTOs, FluentValidation, paging, filtering, sorting and auto‑Swagger |
|
FastCrud.PersistenceEfCore
Fast and flexible CRUD API generator for .NET 9: minimal API + EF Core with DTOs, FluentValidation, paging, filtering, sorting and auto‑Swagger |
GitHub repositories
This package is not used by any popular GitHub repositories.