NPv.DataAccess.Abstractions
1.1.1
dotnet add package NPv.DataAccess.Abstractions --version 1.1.1
NuGet\Install-Package NPv.DataAccess.Abstractions -Version 1.1.1
<PackageReference Include="NPv.DataAccess.Abstractions" Version="1.1.1" />
<PackageVersion Include="NPv.DataAccess.Abstractions" Version="1.1.1" />
<PackageReference Include="NPv.DataAccess.Abstractions" />
paket add NPv.DataAccess.Abstractions --version 1.1.1
#r "nuget: NPv.DataAccess.Abstractions, 1.1.1"
#:package NPv.DataAccess.Abstractions@1.1.1
#addin nuget:?package=NPv.DataAccess.Abstractions&version=1.1.1
#tool nuget:?package=NPv.DataAccess.Abstractions&version=1.1.1
NPv.DataAccess.Abstractions
Minimal interface contract for generic repository access in .NET applications.
✨ Overview
This library defines core abstractions for working with persistent data in a clean, provider-agnostic way. It includes:
IGenericRepository
— for standard CRUD operations on aggregate roots or entitiesISqlExecutor
— for executing raw SQL queries and commands asynchronously
These abstractions are designed to support layered architectures, promote separation of concerns, and enable swapping implementations (e.g., EF Core, Dapper) with minimal friction.
🧱 Interfaces
IGenericRepository
Standard CRUD contract for entity-oriented persistence:
Task<TEntity?> GetAsync<TEntity>(Guid id, string includeProperties = "");
Task<TEntity?> GetAsync<TEntity>(Expression<Func<TEntity, bool>>? filter, string includeProperties = "");
Task<IEnumerable<TEntity>> ListAsync<TEntity>(...);
Task<int> CountAsync<TEntity>(...);
Task AddAsync<TEntity>(TEntity entity);
Task DeleteAsync<TEntity>(Guid id);
...
ISqlExecutor
Lightweight abstraction over raw SQL execution, ideal for high-performance scenarios using Dapper or similar tools:
Task<T> QueryFirstAsync<T>(string sql, object? parameters = null);
Task<T?> QueryFirstOrDefaultAsync<T>(string sql, object? parameters = null);
Task<T> QuerySingleAsync<T>(string sql, object? parameters = null);
Task<T?> QuerySingleOrDefaultAsync<T>(string sql, object? parameters = null);
Task<IEnumerable<T>> QueryAsync<T>(string sql, object? parameters = null);
Task<int> ExecuteAsync(string sql, object? parameters = null);
...
🔧 Usage
Implement the interface in your data layer (e.g., using EF Core):
For IGenericRepository
public class EfGenericRepository : IGenericRepository { ... }
For ISqlExecutor
Implement using your SQL technology of choice, e.g. via Dapper:
public class DapperSqlExecutor : ISqlExecutor { ... }
Inject ISqlExecutor
where you need to run raw SQL without managing connections or boilerplate manually.
📦 Installation
This package is published as part of the NPv.Foundation.Net
architecture.
To install via NuGet:
dotnet add package NPv.DataAccess.Abstractions
🧩 Related Packages
NPv.DataAccess.Ef
– EF Core implementation of IGenericRepositoryNPv.DataAccess.Dapper.Executor
– Dapper-based implementation of ISqlExecutor
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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 was computed. 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. |
-
net9.0
- NPv.Domain.Core (>= 1.1.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on NPv.DataAccess.Abstractions:
Package | Downloads |
---|---|
NPv.DataAccess.Ef
NPv's IGenericRepository realisation for EF including: IDbContextFactory, IDbContextProvider, PerRequestDbContextProvider, ConsoleDbContextProvider |
|
NPv.DataAccess.Dapper.Executor
Dapper-based implementation of ISqlExecutor for raw SQL access in .NET applications. Wraps common Dapper methods and manages connection lifecycle. |
GitHub repositories
This package is not used by any popular GitHub repositories.