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
                    
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="RA.Utilities.Data.Abstractions" Version="10.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RA.Utilities.Data.Abstractions" Version="10.0.2" />
                    
Directory.Packages.props
<PackageReference Include="RA.Utilities.Data.Abstractions" />
                    
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 RA.Utilities.Data.Abstractions --version 10.0.2
                    
#r "nuget: RA.Utilities.Data.Abstractions, 10.0.2"
                    
#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 RA.Utilities.Data.Abstractions@10.0.2
                    
#: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=RA.Utilities.Data.Abstractions&version=10.0.2
                    
Install as a Cake Addin
#tool nuget:?package=RA.Utilities.Data.Abstractions&version=10.0.2
                    
Install as a Cake Tool

RA.Utilities.Data.Abstractions

NuGet version Codecov NuGet Downloads Documentation GitHub license

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 like GetByIdAsync and ListAsync. Implementations of this interface are optimized for querying and should not modify data.

  • IWriteRepositoryBase<T>: Defines write-only operations like AddAsync, UpdateAsync, and DeleteAsync.

  • IRepositoryBase<T>: A convenience interface that inherits from both IReadRepositoryBase<T> and IWriteRepositoryBase<T>, providing a full suite of CRUD operations.

IDbContext and IUnitOfWork

  • IDbContext: A marker interface that your DbContext should implement. This allows repository implementations to depend on an abstraction rather than a concrete DbContext, which is crucial for unit testing.
  • IUnitOfWork: Defines a contract for managing transactions. Its SaveChangesAsync() 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 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 (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