eQuantic.Core.Application.Crud
2.0.0
dotnet add package eQuantic.Core.Application.Crud --version 2.0.0
NuGet\Install-Package eQuantic.Core.Application.Crud -Version 2.0.0
<PackageReference Include="eQuantic.Core.Application.Crud" Version="2.0.0" />
<PackageVersion Include="eQuantic.Core.Application.Crud" Version="2.0.0" />
<PackageReference Include="eQuantic.Core.Application.Crud" />
paket add eQuantic.Core.Application.Crud --version 2.0.0
#r "nuget: eQuantic.Core.Application.Crud, 2.0.0"
#:package eQuantic.Core.Application.Crud@2.0.0
#addin nuget:?package=eQuantic.Core.Application.Crud&version=2.0.0
#tool nuget:?package=eQuantic.Core.Application.Crud&version=2.0.0
eQuantic.Core.Api.Crud Library
The eQuantic Core API CRUD provides all the implementation needed to publish CRUD APIs.
To install eQuantic.Core.Api.Crud, run the following command in the Package Manager Console
Install-Package eQuantic.Core.Api.Crud
Example of implementation
The data entities
[Table("orders")]
public class OrderData : EntityDataBase
{
[Key]
public string Id { get; set; } = string.Empty;
public DateTime Date { get; set; }
public virtual ICollection<OrderItemData> Items { get; set; } = new HashSet<OrderItemData>();
}
[Table("orderItems")]
public class OrderItemData : EntityDataBase, IWithReferenceId<OrderItemData, int>
{
[Key]
public int Id { get; set; }
public int OrderId { get; set; }
[ForeignKey(nameof(OrderId))]
public virtual OrderData? Order { get; set; }
[Required]
[MaxLength(200)]
public string Name { get; set; } = string.Empty;
}
The models
public class Order
{
public string Id { get; set; } = string.Empty;
public DateTime Date { get; set; }
}
public class OrderItem
{
public int Id { get; set; }
public int OrderId { get; set; }
public string Name { get; set; } = string.Empty;
}
The request models
public class OrderRequest
{
public DateTime? Date { get; set; }
}
public class OrderItemRequest
{
public string? Name { get; set; }
}
The mappers
public class OrderMapper : IMapper<OrderData, Order>, IMapper<OrderRequest, OrderData>
{
public Order? Map(OrderData? source)
{
return Map(source, new Order());
}
public Order? Map(OrderData? source, Order? destination)
{
if (source == null)
{
return null;
}
if (destination == null)
{
return Map(source);
}
destination.Id = source.Id;
destination.Date = source.Date;
return destination;
}
public OrderData? Map(OrderRequest? source)
{
return Map(source, new OrderData());
}
public OrderData? Map(OrderRequest? source, OrderData? destination)
{
if (source == null)
{
return null;
}
if (destination == null)
{
return Map(source);
}
destination.Date = source.Date ?? DateTime.UtcNow;
return destination;
}
}
The services
public interface IOrderService : ICrudService<Order, OrderRequest>
{
}
[MapCrudEndpoints]
public class OrderService : CrudServiceBase<Order, OrderRequest, OrderData, UserData>, IOrderService
{
public OrderService(IQueryableUnitOfWork unitOfWork, IMapperFactory mapperFactory) : base(unitOfWork, mapperFactory)
{
}
}
The Program.cs
var builder = WebApplication.CreateBuilder(args);
var assembly = typeof(Program).Assembly;
builder.Services.AddDbContext<ExampleDbContext>(opt =>
opt.UseInMemoryDatabase("ExampleDb"));
builder.Services.AddQueryableRepositories<ExampleUnitOfWork>(opt =>
{
opt.FromAssembly(assembly)
.AddLifetime(ServiceLifetime.Scoped);
});
builder.Services
.AddMappers(opt => opt.FromAssembly(assembly))
.AddTransient<IExampleService, ExampleService>()
.AddControllers()
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
})
.AddFilterModelBinder()
.AddSortModelBinder();
builder.Services
.AddEndpointsApiExplorer()
.AddApiDocumentation(opt => opt.WithTitle("Example API"));
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseApiDocumentation();
}
app.UseHttpsRedirection();
app.UseRouting();
app.MapControllers();
app.MapCrud<Order, OrderRequest, IOrderService>();
app.Run();
or
...
app.MapAllCrud(opt => opt.FromAssembly(assembly));
app.Run();
Using MVC Controllers (traditional style)
Besides the Minimal API endpoints, the same services can be exposed through MVC controllers, with the same routes, references, complex keys, verbs and authorization. There are two ways to use it.
Auto-registered controllers
Mirrors MapAllCrud: every service annotated with [MapCrudEndpoints] gets a generated controller.
builder.Services
.AddControllers()
.AddCrudControllers(opt => opt.FromAssembly(assembly));
// ...
app.MapControllers();
AddCrudControllers reuses the same option model as MapAllCrud (route format, validation,
authorization, references). Use WithGroup("...") to mount every generated controller under a shared
prefix (useful, for example, to expose them side by side with the Minimal API endpoints):
builder.Services
.AddControllers()
.AddCrudControllers(opt => opt.FromAssembly(assembly).WithGroup("mvc"));
Explicit controllers
Derive from CrudControllerBase<TEntity, TRequest, TKey> (or ReaderControllerBase<TEntity, TKey>
for read-only) and declare a route:
[Route("v1/orders")]
public class OrdersController : CrudControllerBase<Order, OrderRequest, string>
{
public OrdersController(IOrderService service) : base(service)
{
}
}
Referenced and complex-key variants are also available
(ReferencedCrudControllerBase<...>, ReferencedReaderControllerBase<...>).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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 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
- eQuantic.Core.Application (>= 3.0.0)
- eQuantic.Core.DataModel (>= 3.0.0)
- eQuantic.Core.Domain (>= 3.0.0)
- eQuantic.Core.Exceptions (>= 3.0.0)
- eQuantic.Mapper (>= 2.2.1)
- Humanizer (>= 2.14.1)
-
net8.0
- eQuantic.Core.Application (>= 3.0.0)
- eQuantic.Core.DataModel (>= 3.0.0)
- eQuantic.Core.Domain (>= 3.0.0)
- eQuantic.Core.Exceptions (>= 3.0.0)
- eQuantic.Mapper (>= 2.2.1)
- Humanizer (>= 2.14.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on eQuantic.Core.Application.Crud:
| Package | Downloads |
|---|---|
|
eQuantic.Core.Api.Crud
eQuantic API CRUD Library |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 0 | 7/21/2026 |
| 1.9.1 | 312 | 7/6/2025 |
| 1.9.0 | 319 | 6/22/2025 |
| 1.8.3 | 291 | 6/17/2025 |
| 1.8.2 | 454 | 6/11/2025 |
| 1.8.1 | 404 | 6/11/2025 |
| 1.8.0 | 222 | 5/30/2025 |
| 1.7.35 | 294 | 5/29/2025 |
| 1.7.34 | 281 | 5/10/2025 |
| 1.7.33 | 208 | 5/10/2025 |
| 1.7.32 | 247 | 4/19/2025 |
| 1.7.31 | 248 | 4/19/2025 |
| 1.7.30 | 275 | 2/27/2025 |
| 1.7.29 | 279 | 2/23/2025 |
| 1.7.28 | 306 | 2/18/2025 |
| 1.7.27 | 378 | 1/21/2025 |
| 1.7.26 | 476 | 1/10/2025 |
| 1.7.25 | 251 | 1/8/2025 |
| 1.7.24 | 311 | 12/27/2024 |
| 1.7.23 | 360 | 12/26/2024 |
Generic CRUD endpoints for Entities