PouryaKit.Persistence.Dapper 0.1.0-preview.2

This is a prerelease version of PouryaKit.Persistence.Dapper.
dotnet add package PouryaKit.Persistence.Dapper --version 0.1.0-preview.2
                    
NuGet\Install-Package PouryaKit.Persistence.Dapper -Version 0.1.0-preview.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="PouryaKit.Persistence.Dapper" Version="0.1.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PouryaKit.Persistence.Dapper" Version="0.1.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="PouryaKit.Persistence.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 PouryaKit.Persistence.Dapper --version 0.1.0-preview.2
                    
#r "nuget: PouryaKit.Persistence.Dapper, 0.1.0-preview.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 PouryaKit.Persistence.Dapper@0.1.0-preview.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=PouryaKit.Persistence.Dapper&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PouryaKit.Persistence.Dapper&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Tool

PouryaKit.Persistence.Dapper

NuGet .NET 10 License: MIT

PouryaKit.Persistence.Dapper

Plain-SQL reads with Dapper on a pooled PostgreSQL connection. A query's handler takes IReadConnectionFactory, leases an open connection from the Host's one pool, and every typed ID of the Module works as a Dapper parameter and result. For a list, PageSql and QueryPageAsync read one Page of it, sorted and filtered only by what the query declared.

Install

dotnet add package PouryaKit.Persistence.Dapper --prerelease

When to use it

  • A query reads rows for display, by ID or by a filter you write.
  • A query answers a sorted and filtered Page of a list.
  • You read or write typed IDs with Dapper.

It pairs with PouryaKit.Cqrs, whose queries it serves, and sits beside PouryaKit.Persistence.Postgres, whose EF Core model writes what you read here.

Quick start

Register the read connection in the Composition Root:

module.AddPouryaKitDapper(connectionName: "app");

Lease a connection in the handler and write the SQL against your own schema, as the Proving Sample does:

internal sealed class GetProductQueryHandler(IReadConnectionFactory connections)
    : QueryHandler<GetProductQuery, ProductDto>
{
    public override async Task<Result<ProductDto>> Handle(
        GetProductQuery query,
        CancellationToken cancellationToken
    )
    {
        await using var connection = await connections.OpenAsync(cancellationToken);
        var product = await connection.QuerySingleOrDefaultAsync<ProductDto>(
            new CommandDefinition(
                "select id, category_id as categoryid, name from catalog.products where id = @Id and tenant = current_setting('pouryakit.tenant') and is_deleted = false",
                new { Id = new ProductId(query.ProductId) },
                cancellationToken: cancellationToken
            )
        );
        return product is null ? ProductErrors.NotFound : product;
    }
}

What you get

  • One PostgreSQL pool per Host, leased to each read.
  • Typed IDs as parameters and results, with nothing to register for each one.
  • A Page whose sort and filters come only from what the query declared, so input never becomes SQL.
  • In a tenant-scoped Module, a lease that binds the Operation's tenant.

Dapper runs exactly the SQL you write, so no EF Core query filter reaches it. A read of a soft-deletable table leaves out the removed rows itself, and in a tenant-scoped Module a read of a tenant-scoped table states the tenant the lease bound.

Learn more

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 PouryaKit.Persistence.Dapper:

Package Downloads
PouryaKit.Reporting.Module

The Kit's report Module: report jobs generated in the background, stored through the Host's file storage and served to their requester by a time-limited link.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.2 69 11/1/2026
0.1.0-preview.1 79 10/31/2026
0.1.0-preview.0.28 71 10/26/2026