NPv.DataAccess.Ef
2.5.1
dotnet add package NPv.DataAccess.Ef --version 2.5.1
NuGet\Install-Package NPv.DataAccess.Ef -Version 2.5.1
<PackageReference Include="NPv.DataAccess.Ef" Version="2.5.1" />
<PackageVersion Include="NPv.DataAccess.Ef" Version="2.5.1" />
<PackageReference Include="NPv.DataAccess.Ef" />
paket add NPv.DataAccess.Ef --version 2.5.1
#r "nuget: NPv.DataAccess.Ef, 2.5.1"
#:package NPv.DataAccess.Ef@2.5.1
#addin nuget:?package=NPv.DataAccess.Ef&version=2.5.1
#tool nuget:?package=NPv.DataAccess.Ef&version=2.5.1
NPv.DataAccess.Ef
EF Core implementation for NPv.DataAccess.Abstractions.
Contents
EFCoreGenericRepository—IGenericRepositoryimplementation.IDbContextProvider/DbContextProvider— scoped unit of work with explicitCommitAsync.GuidV7ValueGenerator— Guid v7 generation for entityId.DefaultString256MaxLengthMapping—nvarchar(256)convention for string properties (unless explicitly configured otherwise).
Registration
services.AddDbContext<YourDbContext>(...);
services.AddScoped<DbContext>(sp => sp.GetRequiredService<YourDbContext>());
services.AddScoped<IDbContextProvider, DbContextProvider>();
services.AddScoped<IGenericRepository, EFCoreGenericRepository>();
Usage
public sealed class CreateOrderHandler(
IGenericRepository repository,
IDbContextProvider uow)
{
public async Task HandleAsync(CreateOrder command, CancellationToken ct)
{
await repository.AddAsync(new Order(), ct);
await uow.CommitAsync(ct);
}
}
Include Paths
IGenericRepository uses string include paths (IReadOnlyCollection<string>):
var order = await repository.GetAsync<Order>(
orderId,
ct,
includes: new[] { "Items", "Customer", "Customer.Address" });
Notes
- All async methods require
CancellationToken. DbContextProviderdoes not auto-commit on dispose.- After
CommitAsync, the current unit of work is completed.
Author's Note
This library grew out of my long-standing personal interest in structuring and publishing open source packages. Over time, I’ve revisited and refined earlier internal utilities and ideas, giving them a more consistent shape and preparing them for wider reuse. Along the way, I’ve also taken the opportunity to explore how open source distribution and licensing work in the .NET ecosystem.
It’s a small step toward something I’ve always wanted to try — sharing practical, minimal tools that reflect years of learning, experimentation, and refinement.
Hopefully, someone finds it useful.
Nikolai 😛
⚖️ License
MIT — you are free to use this in commercial and open-source software.
| 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
- Microsoft.EntityFrameworkCore (>= 10.0.7)
- NPv.DataAccess.Abstractions (>= 2.6.0)
- NPv.Domain.Core (>= 2.0.0)
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 |
|---|---|---|
| 2.5.1 | 114 | 4/22/2026 |
| 2.5.0 | 133 | 2/11/2026 |
| 2.4.2 | 111 | 2/11/2026 |
| 2.4.1 | 113 | 2/11/2026 |
| 2.4.0 | 107 | 2/10/2026 |
| 2.3.0 | 118 | 2/10/2026 |
| 2.2.0 | 118 | 2/8/2026 |
| 2.1.0 | 133 | 2/1/2026 |
| 2.0.2 | 130 | 1/11/2026 |
| 2.0.1 | 125 | 1/11/2026 |
| 2.0.0 | 216 | 12/24/2025 |
| 1.4.1 | 236 | 10/1/2025 |
| 1.4.0 | 221 | 10/1/2025 |
| 1.3.1 | 227 | 8/18/2025 |
| 1.3.0 | 264 | 8/8/2025 |
| 1.2.1 | 194 | 6/15/2025 |
| 1.2.0 | 210 | 6/14/2025 |
| 1.1.2 | 243 | 5/22/2025 |
| 1.1.1 | 212 | 5/22/2025 |
| 1.1.0 | 210 | 5/22/2025 |