CanDoItAll.Ledger.Persistence.PostgreSql 0.1.18

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

CanDoItAll.Ledger.Persistence.PostgreSql

PostgreSQL persistence, migrations, schema adoption, and resilient dependency-injection setup for CanDoItAll Ledger.

This is the supported durable relational provider for Ledger state. It registers the EF Core context factory and stores, supplies the migration set, and replaces the provider-neutral migrator with PostgreSQL-aware migration and schema-audit behavior.

Requirements

  • .NET 10
  • A supported PostgreSQL server
  • A protected connection string with permission to use the Ledger schema

Install

dotnet add package CanDoItAll.Ledger.Persistence.PostgreSql

Register

using CanDoItAll.Ledger.Persistence.PostgreSql;

builder.Services.AddLedgerPostgreSqlPersistence(
    builder.Configuration.GetConnectionString("Ledger")
        ?? throw new InvalidOperationException(
            "Ledger connection string is missing."),
    configure: options =>
    {
        options.EnableRetryOnFailure = true;
        options.MaxRetryCount = 5;
        options.CommandTimeoutSeconds = 30;
    });

Configuration binding is also supported:

builder.Services.AddLedgerPostgreSqlPersistence(
    builder.Configuration,
    "Ledger:PostgreSql");

The bound section maps to LedgerPostgreSqlOptions, including ConnectionString, MigrationsAssembly, CommandTimeoutSeconds, EnableRetryOnFailure, MaxRetryCount, and MaxRetryDelay.

Apply Migrations

The host owns the startup migration policy:

using CanDoItAll.Ledger.Persistence.EFCore;
using Microsoft.EntityFrameworkCore;

await using var scope = app.Services.CreateAsyncScope();
CancellationToken cancellationToken = app.Lifetime.ApplicationStopping;
var factory =
    scope.ServiceProvider.GetRequiredService<IDbContextFactory<LedgerDbContext>>();
var migrator =
    scope.ServiceProvider.GetRequiredService<ILedgerSchemaMigrator>();

await using LedgerDbContext db =
    await factory.CreateDbContextAsync(cancellationToken);

LedgerSchemaMigrationResult result =
    await migrator.MigrateAsync(db, cancellationToken);

Operational Notes

  • Registration does not automatically apply migrations.
  • Back up authoritative data and test a restore before schema changes.
  • The migrator uses a PostgreSQL advisory lock to serialize concurrent migration attempts.
  • Existing schema adoption is refused when required tables are missing or stored data violates current Ledger invariants.
  • Retry-on-failure is disabled unless the host enables it.
  • Keep connection strings out of committed configuration and package output.
  • Validate health, a representative read, and a controlled write after migration.

See the container quickstart, backup and restore guide, and full source.

This package is part of the CanDoItAll ecosystem and uses the repository's MIT License.

Product 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. 
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
0.1.18 37 7/31/2026
0.1.17 39 7/30/2026