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

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.0
  • net10.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 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. 
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
1.2.0 95 8/29/2026