PouryaKit.Persistence.Dapper
0.1.0-preview.2
dotnet add package PouryaKit.Persistence.Dapper --version 0.1.0-preview.2
NuGet\Install-Package PouryaKit.Persistence.Dapper -Version 0.1.0-preview.2
<PackageReference Include="PouryaKit.Persistence.Dapper" Version="0.1.0-preview.2" />
<PackageVersion Include="PouryaKit.Persistence.Dapper" Version="0.1.0-preview.2" />
<PackageReference Include="PouryaKit.Persistence.Dapper" />
paket add PouryaKit.Persistence.Dapper --version 0.1.0-preview.2
#r "nuget: PouryaKit.Persistence.Dapper, 0.1.0-preview.2"
#:package PouryaKit.Persistence.Dapper@0.1.0-preview.2
#addin nuget:?package=PouryaKit.Persistence.Dapper&version=0.1.0-preview.2&prerelease
#tool nuget:?package=PouryaKit.Persistence.Dapper&version=0.1.0-preview.2&prerelease

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 | 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
- Dapper (>= 2.1.89)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.13)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.13)
- Npgsql (>= 10.0.3)
- PouryaKit.Core (>= 0.1.0-preview.2)
- PouryaKit.Cqrs (>= 0.1.0-preview.2)
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 |