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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NPv.DataAccess.Ef" Version="2.5.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NPv.DataAccess.Ef" Version="2.5.1" />
                    
Directory.Packages.props
<PackageReference Include="NPv.DataAccess.Ef" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NPv.DataAccess.Ef --version 2.5.1
                    
#r "nuget: NPv.DataAccess.Ef, 2.5.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NPv.DataAccess.Ef@2.5.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NPv.DataAccess.Ef&version=2.5.1
                    
Install as a Cake Addin
#tool nuget:?package=NPv.DataAccess.Ef&version=2.5.1
                    
Install as a Cake Tool

NPv.DataAccess.Ef

EF Core implementation for NPv.DataAccess.Abstractions.

Contents

  • EFCoreGenericRepositoryIGenericRepository implementation.
  • IDbContextProvider / DbContextProvider — scoped unit of work with explicit CommitAsync.
  • GuidV7ValueGenerator — Guid v7 generation for entity Id.
  • DefaultString256MaxLengthMappingnvarchar(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.
  • DbContextProvider does 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed