RA.Utilities.Data.Abstractions
10.0.2
Prefix Reserved
dotnet add package RA.Utilities.Data.Abstractions --version 10.0.2
NuGet\Install-Package RA.Utilities.Data.Abstractions -Version 10.0.2
<PackageReference Include="RA.Utilities.Data.Abstractions" Version="10.0.2" />
<PackageVersion Include="RA.Utilities.Data.Abstractions" Version="10.0.2" />
<PackageReference Include="RA.Utilities.Data.Abstractions" />
paket add RA.Utilities.Data.Abstractions --version 10.0.2
#r "nuget: RA.Utilities.Data.Abstractions, 10.0.2"
#:package RA.Utilities.Data.Abstractions@10.0.2
#addin nuget:?package=RA.Utilities.Data.Abstractions&version=10.0.2
#tool nuget:?package=RA.Utilities.Data.Abstractions&version=10.0.2
RA.Utilities.Data.Abstractions
RA.Utilities.Data.Abstractions provides a collection of essential interfaces for building a decoupled and testable data access layer. It establishes contracts for the Repository and Unit of Work patterns, which are fundamental to Clean Architecture.
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
✨ Core Abstractions
This package provides a set of interfaces to enforce a clean, CQS-friendly data access strategy.
Repository Interfaces
The repository pattern is split into read and write interfaces to support Command Query Separation (CQS).
IReadRepositoryBase<T>: Defines read-only operations likeGetByIdAsyncandListAsync. Implementations of this interface are optimized for querying and should not modify data.IWriteRepositoryBase<T>: Defines write-only operations likeAddAsync,UpdateAsync, andDeleteAsync.IRepositoryBase<T>: A convenience interface that inherits from bothIReadRepositoryBase<T>andIWriteRepositoryBase<T>, providing a full suite of CRUD operations.
IDbContext and IUnitOfWork
IDbContext: A marker interface that yourDbContextshould implement. This allows repository implementations to depend on an abstraction rather than a concreteDbContext, which is crucial for unit testing.IUnitOfWork: Defines a contract for managing transactions. ItsSaveChangesAsync()method ensures that all changes made across multiple repositories are saved as a single, atomic operation.
🚀 Usage
These abstractions are designed to be implemented in your Infrastructure layer and consumed by your Application layer.
1. Define Your Repository Interface
In your Application layer, define an interface for your entity that inherits from the base abstractions.
// An example of a concrete repository implementation
using RA.Utilities.Data.Abstractions;
using YourApp.Domain.Entities;
public class ProductRepository : IRepositoryBase<Product>
{
// You can add custom, entity-specific query methods here
Task<Product?> GetProductBySkuAsync(string sku);
}
2. Implement the Concrete Repository
In your Infrastructure layer, implement the interface. You can inherit from RepositoryBase<T> (provided by RA.Utilities.Data.EntityFramework) to get the standard implementations for free.
using RA.Utilities.Data.EntityFramework;
using YourApp.Domain.Entities;
using YourApp.Persistence;
public class ProductRepository : IRepository<Product, int>
{
private readonly AppDbContext _context;
public ProductRepository(AppDbContext context)
{
_context = context;
}
public async Task<Product> GetProductBySkuAsync(int id, CancellationToken cancellationToken)
{
return await _dbContext.Set<Product>().FirstOrDefaultAsync(p => p.Sku == sku);
}
public void Add(Product entity)
{
_context.Products.Add(entity);
}
// ... other method implementations
}
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.1)
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 | 34 | 1/11/2026 |
| 10.0.1 | 215 | 12/14/2025 |
| 10.0.0 | 199 | 11/24/2025 |
| 10.0.0-rc.2 | 155 | 10/30/2025 |