AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql
6.0.0
dotnet add package AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql --version 6.0.0
NuGet\Install-Package AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql -Version 6.0.0
<PackageReference Include="AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql" Version="6.0.0" />
<PackageVersion Include="AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql" Version="6.0.0" />
<PackageReference Include="AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql" />
paket add AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql --version 6.0.0
#r "nuget: AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql, 6.0.0"
#:package AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql@6.0.0
#addin nuget:?package=AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql&version=6.0.0
#tool nuget:?package=AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql&version=6.0.0
AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql
PostgreSQL dialect for AdaskoTheBeAsT.Dapper.NodaTime.
It registers the NodaTime type handlers and shapes every parameter with the matching NpgsqlDbType in
addition to DbType.
Provider client: Npgsql.
Installation
dotnet add package AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql
Usage
using AdaskoTheBeAsT.Dapper.NodaTime.PostgreSql;
using NodaTime;
PostgreSqlDapperNodaTimeSetup.Register(DateTimeZoneProviders.Tzdb);
Call it once during startup. The dialect is public as PostgreSqlNodaTimeConfiguration if you want to pass it
to DapperNodaTimeSetup.Register yourself.
Parameter mapping
| NodaTime type | Value written | DbType |
NpgsqlDbType |
Recommended column |
|---|---|---|---|---|
Instant |
DateTime (UTC) |
DateTime2 |
TimestampTz |
TIMESTAMPTZ |
LocalDate |
DateTime at midnight |
Date |
Date |
DATE |
LocalDateTime |
DateTime (unspecified) |
DateTime2 |
Timestamp |
TIMESTAMP |
LocalTime |
TimeSpan since midnight |
Time |
Time |
TIME |
OffsetDateTime |
DateTimeOffset converted to UTC |
DateTimeOffset |
TimestampTz |
TIMESTAMPTZ |
Offset |
int seconds |
Int32 |
Integer |
INTEGER |
Duration |
long nanoseconds |
Int64 |
Bigint |
BIGINT |
Period |
ISO8601 roundtrip string | AnsiString |
Varchar |
VARCHAR(176) |
CalendarSystem |
calendar id | AnsiString |
Varchar |
VARCHAR(50) |
DateTimeZone |
time zone id | AnsiString |
Varchar |
VARCHAR(50) |
Reading notes
Npgsql returns DateOnly for date columns and TimeOnly for time columns on modern targets; both are
handled, so LocalDate and LocalTime round-trip without extra configuration.
Offset handling
TIMESTAMPTZ stores an instant, not an offset. OffsetDateTime values are therefore normalized to UTC on the
way in, and read back with offset zero. When the original offset is part of your domain, persist it separately:
public sealed class Reminder
{
public LocalDateTime LocalDateTime { get; set; }
public Offset Offset { get; set; }
public OffsetDateTime ToOffsetDateTime() => new(LocalDateTime, Offset);
}
Recommended schema
CREATE TABLE Events (
Id BIGINT PRIMARY KEY,
CreatedAt TIMESTAMPTZ NOT NULL, -- Instant
ScheduledAt TIMESTAMP NOT NULL, -- LocalDateTime
EventDate DATE NOT NULL, -- LocalDate
StartTime TIME NOT NULL, -- LocalTime
StartsAtUtc TIMESTAMPTZ NULL, -- OffsetDateTime (UTC normalized)
UtcOffsetSeconds INTEGER NULL, -- Offset
RunTimeNanoseconds BIGINT NULL, -- Duration
Recurrence VARCHAR(176) NULL, -- Period
Calendar VARCHAR(50) NULL, -- CalendarSystem
TimeZone VARCHAR(50) NULL); -- DateTimeZone
Example
using Dapper;
using NodaTime;
using Npgsql;
using var connection = new NpgsqlConnection(connectionString);
await connection.ExecuteAsync(
"INSERT INTO Events (Id, CreatedAt, EventDate, StartTime) VALUES (@Id, @CreatedAt, @EventDate, @StartTime)",
new
{
Id = 1L,
CreatedAt = SystemClock.Instance.GetCurrentInstant(),
EventDate = new LocalDate(2025, 11, 23),
StartTime = new LocalTime(10, 0),
});
Target frameworks
net10.0, net9.0, net8.0, net481, net48, net472, net471, net47, net462.
Npgsql 10.x is used on .NET 8+ and Npgsql 8.x on .NET Framework targets.
Links
| 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 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. |
| .NET Framework | net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 is compatible. |
-
.NETFramework 4.6.2
- AdaskoTheBeAsT.Dapper.NodaTime (>= 6.0.0)
- Npgsql (>= 8.0.9 && < 9.0.0)
-
.NETFramework 4.7
- AdaskoTheBeAsT.Dapper.NodaTime (>= 6.0.0)
- Npgsql (>= 8.0.9 && < 9.0.0)
-
.NETFramework 4.7.1
- AdaskoTheBeAsT.Dapper.NodaTime (>= 6.0.0)
- Npgsql (>= 8.0.9 && < 9.0.0)
-
.NETFramework 4.7.2
- AdaskoTheBeAsT.Dapper.NodaTime (>= 6.0.0)
- Npgsql (>= 8.0.9 && < 9.0.0)
-
.NETFramework 4.8
- AdaskoTheBeAsT.Dapper.NodaTime (>= 6.0.0)
- Npgsql (>= 8.0.9 && < 9.0.0)
-
.NETFramework 4.8.1
- AdaskoTheBeAsT.Dapper.NodaTime (>= 6.0.0)
- Npgsql (>= 8.0.9 && < 9.0.0)
-
net10.0
- AdaskoTheBeAsT.Dapper.NodaTime (>= 6.0.0)
- Npgsql (>= 10.0.3 && < 11.0.0)
-
net8.0
- AdaskoTheBeAsT.Dapper.NodaTime (>= 6.0.0)
- Npgsql (>= 10.0.3 && < 11.0.0)
-
net9.0
- AdaskoTheBeAsT.Dapper.NodaTime (>= 6.0.0)
- Npgsql (>= 10.0.3 && < 11.0.0)
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 |
|---|---|---|
| 6.0.0 | 87 | 7/29/2026 |