Kck.Persistence.Abstractions
5.0.0
dotnet add package Kck.Persistence.Abstractions --version 5.0.0
NuGet\Install-Package Kck.Persistence.Abstractions -Version 5.0.0
<PackageReference Include="Kck.Persistence.Abstractions" Version="5.0.0" />
<PackageVersion Include="Kck.Persistence.Abstractions" Version="5.0.0" />
<PackageReference Include="Kck.Persistence.Abstractions" />
paket add Kck.Persistence.Abstractions --version 5.0.0
#r "nuget: Kck.Persistence.Abstractions, 5.0.0"
#:package Kck.Persistence.Abstractions@5.0.0
#addin nuget:?package=Kck.Persistence.Abstractions&version=5.0.0
#tool nuget:?package=Kck.Persistence.Abstractions&version=5.0.0
Kck.Persistence.Abstractions
Repository and Unit-of-Work persistence abstractions — IReadRepository<T,TId>, IWriteRepository<T,TId>,
QueryOptions, dynamic filtering and IUnitOfWork. The Entity Framework implementation is
Kck.Persistence.EntityFramework.
Installation
dotnet add package Kck.Persistence.Abstractions
dotnet add package Kck.Persistence.EntityFramework
Quick Start
// Program.cs — register the Entity Framework provider
using Kck.Persistence.EntityFramework.Extensions;
builder.Services.AddKckPersistence(p => p
.UseEntityFramework<AppDbContext>(o => o
.UseSqlServer(builder.Configuration.GetConnectionString("Default")))
.AddAuditInterceptor()); // CreatedDate / ModifiedDate / soft-delete fields
// Repositories come from the unit of work
public sealed class OrderHandlers(IUnitOfWork uow)
{
public Task<Order?> GetAsync(Guid orderId, CancellationToken ct)
=> uow.Repository<Order, Guid>().GetByIdAsync(orderId, cancellationToken: ct);
public async Task<Order> CreateAsync(Order order, CancellationToken ct)
{
await uow.Repository<Order, Guid>().AddAsync(order, ct);
await uow.SaveChangesAsync(cancellationToken: ct);
return order;
}
// Filtered, ordered page; QueryOptions controls soft-deleted rows and change tracking
public Task<IPaginate<Order>> ActiveAsync(CancellationToken ct)
=> uow.Repository<Order, Guid>().GetListAsync(
QueryOptions.None,
predicate: o => o.Total > 0,
orderBy: q => q.OrderByDescending(o => o.CreatedDate),
size: 20,
cancellationToken: ct);
}
When options is omitted, GetAsync / GetListAsync / GetListByDynamicAsync track entities and AnyAsync /
GetByIdAsync / CountAsync do not. QueryOptions.WithDeleted does not track; to load a soft-deleted row and save
changes to it, pass new QueryOptions(IncludeDeleted: true, AsTracking: true).
Resources
| 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
- Kck.Core.Abstractions (>= 5.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Kck.Persistence.Abstractions:
| Package | Downloads |
|---|---|
|
Kck.Pipeline.Mediator
Mediator.Abstractions 3.x-backed pipeline behaviors for Kck. Provides Authorization, Caching, Logging, Transaction, and Validation cross-cutting behaviors. The recommended pipeline provider since Kck v2. Registered via AddKckMediator(). |
|
|
Kck.Persistence.EntityFramework
Entity Framework Core implementations of IReadRepository<T,TId>, IWriteRepository<T,TId>, and IUnitOfWork. Includes AuditInterceptor (auto CreatedDate/ModifiedDate), DynamicFilterExtensions, soft-delete support, and ToPaginateAsync extension. Registered via AddKckEntityFramework<TContext>(). |
|
|
Kck.Bundle.WebApi
Opinionated ASP.NET Core WebAPI starter pack. Registers Serilog, in-memory caching, the JWT token service, Argon2 hashing, InMemory event bus, health checks, rate limiting, security headers, CORS, and global exception handling in a single AddKckWebApiDefaults() call. |
GitHub repositories
This package is not used by any popular GitHub repositories.