RCommon.Dapper 2.3.2-alpha.0.1

This is a prerelease version of RCommon.Dapper.
There is a newer version of this package available.
See the version list below for details.
dotnet add package RCommon.Dapper --version 2.3.2-alpha.0.1
                    
NuGet\Install-Package RCommon.Dapper -Version 2.3.2-alpha.0.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="RCommon.Dapper" Version="2.3.2-alpha.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RCommon.Dapper" Version="2.3.2-alpha.0.1" />
                    
Directory.Packages.props
<PackageReference Include="RCommon.Dapper" />
                    
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 RCommon.Dapper --version 2.3.2-alpha.0.1
                    
#r "nuget: RCommon.Dapper, 2.3.2-alpha.0.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 RCommon.Dapper@2.3.2-alpha.0.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=RCommon.Dapper&version=2.3.2-alpha.0.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=RCommon.Dapper&version=2.3.2-alpha.0.1&prerelease
                    
Install as a Cake Tool

RCommon.Dapper

Dapper implementation of the RCommon persistence abstractions. Provides a lightweight SQL mapper repository using Dapper and Dommel for CRUD operations with expression-based querying, while integrating with the RCommon data store factory and domain event tracking.

Features

  • DapperRepository<TEntity> implementing ISqlMapperRepository<T>, IReadOnlyRepository<T>, and IWriteOnlyRepository<T>
  • Expression-based querying via Dommel's SelectAsync, CountAsync, and AnyAsync extension methods
  • CRUD operations mapped to SQL using Dommel's InsertAsync, UpdateAsync, and DeleteAsync
  • Bulk delete support via DeleteMultipleAsync with expression predicates
  • Find by primary key using Dommel's GetAsync
  • Automatic connection lifecycle management (open/close per operation)
  • Named data store support for multi-database scenarios through IDataStoreFactory and RDbConnection
  • Fluent DI configuration to register database connections as named data stores
  • Domain event tracking integrated into add, update, and delete operations
  • Targets .NET 8, .NET 9, and .NET 10

Installation

dotnet add package RCommon.Dapper

Usage

// Configure in Program.cs or Startup
builder.Services.AddRCommon()
    .WithPersistence<DapperPersistenceBuilder>(dapper =>
    {
        dapper.AddDbConnection<ApplicationDbConnection>("ApplicationDb", options =>
        {
            options.DbFactory = SqlClientFactory.Instance;
            options.ConnectionString = builder.Configuration.GetConnectionString("ApplicationDb");
        });

        dapper.SetDefaultDataStore(defaults =>
            defaults.DefaultDataStoreName = "ApplicationDb");
    });

Your database connection must inherit from RDbConnection:

public class ApplicationDbConnection : RDbConnection
{
    public ApplicationDbConnection(IOptions<RDbConnectionOptions> options)
        : base(options) { }
}

Then inject and use the repository abstractions:

public class ProductService
{
    private readonly ISqlMapperRepository<Product> _productRepo;

    public ProductService(ISqlMapperRepository<Product> productRepo)
    {
        _productRepo = productRepo;
    }

    public async Task<ICollection<Product>> GetActiveProductsAsync()
    {
        return await _productRepo.FindAsync(p => p.IsActive);
    }

    public async Task<Product> GetByIdAsync(int id)
    {
        return await _productRepo.FindAsync(id);
    }
}

Key Types

Type Description
DapperRepository<TEntity> Concrete repository using Dapper/Dommel with expression-based CRUD operations
DapperPersistenceBuilder Fluent builder for registering Dapper database connections and repository services in DI
IDapperBuilder Builder interface exposing AddDbConnection<T>() for registering named database connections

Documentation

For full documentation, visit rcommon.com.

License

Licensed under the Apache License, Version 2.0.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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 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.4.2-alpha.0.10 54 4/5/2026
2.4.2-alpha.0.9 45 3/26/2026
2.4.2-alpha.0.8 45 3/26/2026
2.4.2-alpha.0.7 47 3/26/2026
2.4.2-alpha.0.6 46 3/25/2026
2.4.2-alpha.0.5 48 3/24/2026
2.4.2-alpha.0.1 46 3/24/2026
2.4.1 106 2/18/2026
2.3.2-alpha.0.3 63 2/18/2026
2.3.2-alpha.0.2 54 2/18/2026
2.3.2-alpha.0.1 62 2/9/2026
2.3.1 182 2/5/2026
2.3.0 100 2/3/2026
2.2.2-alpha.0.1 400 12/11/2025
2.2.1-alpha.0.2 148 10/24/2025
2.2.1-alpha.0.1 152 10/24/2025
2.1.11-alpha.0.2 142 10/24/2025
2.1.11-alpha.0.1 110 7/18/2025
2.1.10 289 7/17/2025
2.1.9-alpha.0.1 153 7/17/2025
Loading failed