slothful-crud
1.1.0
dotnet add package slothful-crud --version 1.1.0
NuGet\Install-Package slothful-crud -Version 1.1.0
<PackageReference Include="slothful-crud" Version="1.1.0" />
<PackageVersion Include="slothful-crud" Version="1.1.0" />
<PackageReference Include="slothful-crud" />
paket add slothful-crud --version 1.1.0
#r "nuget: slothful-crud, 1.1.0"
#:package slothful-crud@1.1.0
#addin nuget:?package=slothful-crud&version=1.1.0
#tool nuget:?package=slothful-crud&version=1.1.0
<div align="center"> <img src="docs/assets/slothful-api.jpg" alt="slothful-api logo"> </div>
Slothful CRUD
Slothful CRUD helps you generate CRUD API endpoints for your entities with minimal setup.
Implement ISlothfulEntity, register the library, and expose REST endpoints backed by your DbContext.
Documentation
Full documentation is available at slothful.dev.
Quick Start
- Install package:
dotnet add package slothful-crud
- Register services and endpoint generation:
using SlothfulCrud.Extensions;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDbContext<SlothfulDbContext>(options =>
options.UseInMemoryDatabase("AppDb"));
builder.Services.AddSlothfulCrud<SlothfulDbContext, Program>();
var app = builder.Build();
app.UseSlothfulCrud<SlothfulDbContext, Program>();
app.Run();
The Program type parameter serves as an assembly marker for entity discovery. You can use any type from the assembly containing your entities.
- Implement
ISlothfulEntityon your domain type:
using SlothfulCrud.Domain;
public class Sloth : ISlothfulEntity
{
public Guid Id { get; private set; }
public string Name { get; private set; }
public int Age { get; private set; }
public string DisplayName => Name;
public Sloth(Guid id, string name, int age)
{
Id = id;
Name = name;
Age = age;
}
public void Update(string name, int age)
{
Name = name;
Age = age;
}
}
Generated Endpoints
By default, the following endpoints are generated per entity:
GET /{segment}/{id}- detailsGET /{segment}/list/{page}- browseGET /{segment}/selectable-list/{page}- browse selectablePOST /{segment}- createPUT /{segment}/{id}- updateDELETE /{segment}/{id}- delete
Important Notes
POST createrequest body does not includeid; the key is generated server-side.201 CreatedincludesLocation: /{segment}/{id}and usesIApiSegmentProvider.- Validation is enabled by default (
HasValidation = true). Register validators, e.g.:
builder.Services.AddValidatorsFromAssemblyContaining<YourValidator>();
Common Customizations
- Endpoint segment strategy (
IApiSegmentProvider) - Key generation strategy (
IEntityPropertyKeyValueProvider<TEntity>) - Create constructor selection (
ICreateConstructorBehavior) - Entity and endpoint configuration (
ISlothEntityConfiguration<T>) - Problem handling (
UseSlothfulProblemHandling) - Query customization (
QueryCustomizerinSlothfulOptions)
Performance Benchmarking
BenchmarkDotNet benchmarks are included to track performance regressions and compare internal changes.
Run all benchmarks:
dotnet run -c Release --project library/SlothfulCrud/Tests/SlothfulCrud.Benchmarks -- --filter "*"
Results are exported to:
library/SlothfulCrud/Tests/SlothfulCrud.Benchmarks/BenchmarkDotNet.Artifacts/results/
See details in docs:
Package and License
- NuGet: slothful-crud
- License: MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- FluentValidation (>= 12.1.1)
- Microsoft.EntityFrameworkCore (>= 10.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.0 | 106 | 3/14/2026 |
| 1.0.0 | 99 | 3/12/2026 |
| 1.0.0-rc.3 | 133 | 6/8/2024 |
| 1.0.0-rc.2 | 100 | 6/8/2024 |
| 1.0.0-rc.1 | 124 | 5/24/2024 |