RA.Utilities.Data.Abstractions
10.0.0
Prefix Reserved
See the version list below for details.
dotnet add package RA.Utilities.Data.Abstractions --version 10.0.0
NuGet\Install-Package RA.Utilities.Data.Abstractions -Version 10.0.0
<PackageReference Include="RA.Utilities.Data.Abstractions" Version="10.0.0" />
<PackageVersion Include="RA.Utilities.Data.Abstractions" Version="10.0.0" />
<PackageReference Include="RA.Utilities.Data.Abstractions" />
paket add RA.Utilities.Data.Abstractions --version 10.0.0
#r "nuget: RA.Utilities.Data.Abstractions, 10.0.0"
#:package RA.Utilities.Data.Abstractions@10.0.0
#addin nuget:?package=RA.Utilities.Data.Abstractions&version=10.0.0
#tool nuget:?package=RA.Utilities.Data.Abstractions&version=10.0.0
RA.Utilities.Data.Abstractions
RA.Utilities.Data.Abstractions provides a set of core interfaces for implementing common data access patterns, such as the Repository and Unit of Work. It solves the problem of tightly coupling your business logic to a specific data access technology (like Entity Framework Core).
By coding against these abstractions, you can create a clean, decoupled architecture where the data access layer can be swapped out with minimal impact on your application's core logic.
Getting started
You can install the package via the .NET CLI:
dotnet add package RA.Utilities.Data.Abstractions
Prerequisites
This package contains only interfaces and is designed to be used with a concrete implementation. For example, you would create your own repository classes that implement these interfaces using an ORM like Entity Framework Core.
It is also recommended to use this package with RA.Utilities.Data.Entities, as the repository interfaces are constrained to IEntity.
Usage
The package provides two main interfaces: IRepository<TEntity, TKey> and IUnitOfWork.
IRepository<TEntity, TKey>
This generic interface defines standard CRUD (Create, Read, Update, Delete) operations for an entity.
// An example of a concrete repository implementation
using RA.Utilities.Data.Abstractions;
public class ProductRepository : IRepository<Product, int>
{
private readonly AppDbContext _context;
public ProductRepository(AppDbContext context)
{
_context = context;
}
public async Task<Product> GetByIdAsync(int id, CancellationToken cancellationToken)
{
return await _context.Products.FindAsync(id, cancellationToken);
}
public void Add(Product entity)
{
_context.Products.Add(entity);
}
// ... other method implementations
}
IUnitOfWork
This interface represents a transaction that groups multiple repository operations. It ensures that a series of changes are either all committed or all rolled back, maintaining data integrity.
// An example of a Unit of Work implementation with EF Core
public class UnitOfWork : IUnitOfWork
{
private readonly AppDbContext _context;
public UnitOfWork(AppDbContext context)
{
_context = context;
}
public Task<int> SaveChangesAsync(CancellationToken cancellationToken)
{
return _context.SaveChangesAsync(cancellationToken);
}
}
Injecting into a Service
You can then inject these abstractions into your business services, completely decoupling them from EF Core's DbContext.
public class ProductService
{
private readonly IRepository<Product, int> _productRepository;
private readonly IUnitOfWork _unitOfWork;
public ProductService(IRepository<Product, int> productRepository, IUnitOfWork unitOfWork)
{
_productRepository = productRepository;
_unitOfWork = unitOfWork;
}
public async Task CreateProductAsync(Product product, CancellationToken cancellationToken)
{
_productRepository.Add(product);
await _unitOfWork.SaveChangesAsync(cancellationToken);
}
}
Additional documentation
For more information on how this package fits into the larger RA.Utilities ecosystem, please see the officially documentation.
Feedback
If you have suggestions or find a bug, please open an issue in the RA.Utilities GitHub repository. Contributions are welcome!
| 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
- RA.Utilities.Data.Entities (>= 10.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on RA.Utilities.Data.Abstractions:
| Package | Downloads |
|---|---|
|
RA.Utilities.Data.EntityFramework
Provides generic repository base classes for implementing the Repository and Unit of Work patterns with Entity Framework Core. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.2 | 83 | 1/11/2026 |
| 10.0.1 | 223 | 12/14/2025 |
| 10.0.0 | 207 | 11/24/2025 |
| 10.0.0-rc.2 | 159 | 10/30/2025 |