Rask.Postgres
0.23.0
See the version list below for details.
dotnet add package Rask.Postgres --version 0.23.0
NuGet\Install-Package Rask.Postgres -Version 0.23.0
<PackageReference Include="Rask.Postgres" Version="0.23.0" />
<PackageVersion Include="Rask.Postgres" Version="0.23.0" />
<PackageReference Include="Rask.Postgres" />
paket add Rask.Postgres --version 0.23.0
#r "nuget: Rask.Postgres, 0.23.0"
#:package Rask.Postgres@0.23.0
#addin nuget:?package=Rask.Postgres&version=0.23.0
#tool nuget:?package=Rask.Postgres&version=0.23.0
Rask.Postgres
PostgreSQL for .NET apps on Entity Framework Core. UseRaskPostgres(...) is a drop-in replacement for
UseNpgsql that gives every session the production timeouts — statement_timeout, lock_timeout,
idle_in_transaction_session_timeout — and turns on Npgsql's transient-failure retrying.
SQLite remains Rask's default, and for most single-developer products it is the right answer for a long time. This package is the door out of one box: a managed database, a read replica, or more app instances than one file can serve.
Install
dotnet add package Rask.Postgres
Use
builder.Services.AddDbContextFactory<AppDbContext>((sp, o) => o
.UseRaskPostgres(sp)
.AddInterceptors(sp.GetServices<ISaveChangesInterceptor>()));
The connection string is Rask:ConnectionStrings:App in configuration — in production usually the whole
string, password included, as Rask__ConnectionStrings__App in the environment — and a missing one is an
error naming that key.
Override any default in the Rask:Postgres section:
{ "Rask": { "Postgres": { "StatementTimeout": "00:00:10", "LockTimeout": "00:00:03", "Retry": { "MaxCount": 3 } } } }
or through the optional configure delegate, which runs after the section and wins:
o.UseRaskPostgres(sp, p =>
{
p.StatementTimeout = TimeSpan.FromSeconds(10);
p.LockTimeout = TimeSpan.FromSeconds(3);
p.Retry.MaxCount = 3;
});
What the defaults do
| Setting | Default | Why |
|---|---|---|
StatementTimeout |
30s | A runaway query otherwise runs until the client disconnects. |
LockTimeout |
10s | The analogue of SQLite's busy_timeout. Without it, a statement stuck behind a lock reports as a slow query, which sends you debugging the wrong thing. Must be below StatementTimeout. |
IdleInTransactionSessionTimeout |
1m | An idle-in-transaction session keeps its locks and blocks VACUUM from reclaiming dead rows — the usual way a healthy database quietly bloats. |
Retry.Enabled / MaxCount / MaxDelay |
on / 6 / 30s | Npgsql's own EnableRetryOnFailure, which already knows which PostgreSQL error codes are transient. |
Set a timeout to TimeSpan.Zero to leave it to the server, so a server-level or role-level setting wins
instead of being overwritten.
The timeouts travel as startup parameters in the connection string (Options=-c statement_timeout=…), so they
are the session's defaults: they survive the pool resetting a returned connection, cost no round trip per
query, and reach code that opens the DbConnection itself. A -c your connection string already carries wins.
Behind PgBouncer in transaction mode, add options to its ignore_startup_parameters, or set the timeouts to
TimeSpan.Zero and configure them on the database role.
Retrying is an execution strategy, and like every EF Core retrying strategy it refuses a transaction you
opened yourself outside it: wrap a hand-written BeginTransaction in
context.Database.CreateExecutionStrategy().ExecuteAsync(...), or set Rask:Postgres:Retry:Enabled to false.
SaveChanges, and Rask's jobs, mail, outbox and cache, need nothing.
What stays behind
Litestream continuous backup and file snapshots (Rask.SQLite.Litestream, Rask.SQLite.Snapshots) are
SQLite-only by definition — they replicate and copy a file. On PostgreSQL, backup is your provider's
snapshots or pg_dump. Migrations are unchanged: dotnet ef (and rask db) are provider-agnostic.
Full documentation: https://github.com/pal-tamas/rask/blob/main/docs/data.md#postgresql
| 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. net11.0 is compatible. |
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 10.0.3)
-
net11.0
- Microsoft.Extensions.Configuration.Binder (>= 10.0.12)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 10.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Rask.Postgres:
| Package | Downloads |
|---|---|
|
Rask
The one reference a Rask application needs, server or browser. On a server target (net10.0 or net11.0) it brings the ASP.NET host plus every battery — database (SQLite, PostgreSQL or SQL Server, picked by Rask:Database:Provider), mediator, background jobs, transactional email, cache, file storage, outbox, operator dashboard, durable logs, Web Push, and SQLite snapshots and continuous backup — with RaskApp.Create(args) as the entry point. On a browser target it brings the WebAssembly host, the source-generated mediator, the query cache and remote dispatch. Everything referenced is wired and on; app.Configure(c => c.Jobs.Off()) is how an app does without one. Reference Rask.Server for a lean host with no database. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.23.1-alpha.0.4 | 34 | 9/18/2026 |
| 0.23.1-alpha.0.3 | 33 | 9/18/2026 |
| 0.23.1-alpha.0.2 | 39 | 9/18/2026 |
| 0.23.1-alpha.0.1 | 32 | 9/18/2026 |
| 0.23.0 | 44 | 9/18/2026 |
| 0.22.1-alpha.0.23 | 39 | 9/17/2026 |
| 0.22.1-alpha.0.22 | 41 | 9/17/2026 |
| 0.22.1-alpha.0.21 | 36 | 9/17/2026 |
| 0.22.1-alpha.0.20 | 38 | 9/17/2026 |
| 0.22.1-alpha.0.18 | 40 | 9/17/2026 |
| 0.22.1-alpha.0.16 | 44 | 9/17/2026 |
| 0.22.1-alpha.0.15 | 40 | 9/16/2026 |
| 0.22.1-alpha.0.14 | 41 | 9/16/2026 |
| 0.22.1-alpha.0.13 | 37 | 9/16/2026 |
| 0.22.1-alpha.0.12 | 42 | 9/16/2026 |
| 0.22.1-alpha.0.9 | 49 | 9/16/2026 |
| 0.22.1-alpha.0.8 | 40 | 9/16/2026 |
| 0.22.1-alpha.0.7 | 41 | 9/16/2026 |
| 0.22.1-alpha.0.6 | 44 | 9/16/2026 |
| 0.22.1-alpha.0.4 | 41 | 9/16/2026 |