TypedParameters.Dapper.PostgreSql
1.2.0
dotnet add package TypedParameters.Dapper.PostgreSql --version 1.2.0
NuGet\Install-Package TypedParameters.Dapper.PostgreSql -Version 1.2.0
<PackageReference Include="TypedParameters.Dapper.PostgreSql" Version="1.2.0" />
<PackageVersion Include="TypedParameters.Dapper.PostgreSql" Version="1.2.0" />
<PackageReference Include="TypedParameters.Dapper.PostgreSql" />
paket add TypedParameters.Dapper.PostgreSql --version 1.2.0
#r "nuget: TypedParameters.Dapper.PostgreSql, 1.2.0"
#:package TypedParameters.Dapper.PostgreSql@1.2.0
#addin nuget:?package=TypedParameters.Dapper.PostgreSql&version=1.2.0
#tool nuget:?package=TypedParameters.Dapper.PostgreSql&version=1.2.0
TypedParameters.Dapper.PostgreSql
Explicitly typed PostgreSQL parameters for Dapper using Npgsql.
Installation
dotnet add package TypedParameters.Dapper.PostgreSql --prerelease
Why use it?
Dapper parameter inference is convenient, but PostgreSQL provider metadata can be part of the contract your code already knows. This package makes NpgsqlDbType explicit at the call site while preserving ordinary Dapper usage.
Quick start
using Dapper;
using Dapper.TypedParameters.PostgreSql;
using Npgsql;
await using var connection = new NpgsqlConnection(connectionString);
var customer = await connection.QuerySingleOrDefaultAsync<Customer>(
"""
SELECT id, external_id, created_at
FROM customers
WHERE external_id = @ExternalId
AND created_at >= @CreatedAt;
""",
new
{
ExternalId = PostgresParam.Uuid(externalId),
CreatedAt = PostgresParam.TimestampTz(createdAtUtc)
});
Supported parameter types
| Family | Factories and metadata |
|---|---|
| Strings | Text, VarChar, Char |
| Boolean / numeric | Boolean, SmallInt, Integer, BigInt, Real, Double, Numeric, Money |
| Binary / UUID | Bytea, Uuid |
| JSON | Json, Jsonb |
| Temporal | Date, Time, Timestamp, TimestampTz, Interval |
| Arrays | Array<T>(IList<T>? value, NpgsqlDbType elementType) |
PostgreSQL-specific semantics
varchar / char
PostgresParam.VarChar(value) sends character varying, and PostgresParam.Char(value) sends character. The current API intentionally does not expose a size argument because NpgsqlParameter.Size is not documented here as a PostgreSQL varchar(n) or char(n) server-side typmod contract.
numeric
PostgresParam.Numeric(value) sends unconstrained PostgreSQL numeric. Precision and scale are not public API in this version because the package does not claim a server-side numeric(p, s) typmod contract.
JSON / JSONB
PostgresParam.Json(value) maps to PostgreSQL json. PostgresParam.Jsonb(value) maps to PostgreSQL jsonb. The current contract accepts caller-provided JSON text; automatic POCO JSON serialization is outside the package scope.
timestamp / timestamptz
PostgresParam.Timestamp(value) maps to timestamp without time zone and accepts DateTimeKind.Local or DateTimeKind.Unspecified wall-clock values. PostgresParam.TimestampTz(value) maps to timestamp with time zone, requires DateTimeKind.Utc, and does not convert local or unspecified values.
arrays
PostgresParam.Array<T>(value, elementType) requires an explicit scalar NpgsqlDbType element type and sends NpgsqlDbType.Array | elementType. PostgreSQL arrays are native PostgreSQL parameters, not SQL Server-style table-valued parameters.
Compatibility
net8.0net10.0- Dapper
- Npgsql
Not currently supported
- PostgreSQL enums
- Composites
- Ranges and multiranges
- PostGIS
- NodaTime
- Automatic POCO JSON serialization
- COPY or bulk APIs
- SQL Server-style output parameters
Documentation
See the repository README and full documentation in the repository docs/ directory.
License
MIT.
| Product | Versions 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 was computed. 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. |
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 |
|---|---|---|
| 1.2.0 | 95 | 8/29/2026 |