Claudalisk.Persistence 0.1.0-alpha.5

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

Claudalisk.Persistence

EF Core on PostgreSQL for module contexts: one connection and one transaction per scope, the unit of work and the migration runner.

Setup

services.AddClaudaliskPersistence(connectionString);
services.AddModuleDbContext<OrderingDbContext>("ordering");
  • AddClaudaliskPersistence registers the data source, the scope's connection, IUnitOfWork and DatabaseInitializer. A host has one database, so calling it again with another connection string throws.
  • AddModuleDbContext<T>(schema) registers a context in its own schema, with its migration history in <schema>."__EFMigrationsHistory" and snake_case names. Each context needs its own schema. UseClaudaliskModuleSchema does the same inside an AddDbContext call you write yourself.

One connection and one transaction

Every module context in a scope uses the scope's connection, and IUnitOfWork.RunAsync begins one transaction on it. Each context takes part in that transaction. This is EF Core's documented pattern for sharing a connection and a transaction.

  • A nested RunAsync joins the outer transaction. It commits or rolls back with the outer call.
  • A failed concurrency check surfaces as ConcurrencyConflictException.

What the guard refuses

A module context is refused, when its options are built or validated, if it:

  • is pooled with AddDbContextPool. Each context needs its own scope's connection, and a pool reuses context instances across scopes. See the EF Core notes on DbContext pooling.
  • sets an execution strategy, which is what EnableRetryOnFailure does. A retrying strategy does not work with a transaction that the unit of work began. See connection resiliency. Retry the whole RunAsync call instead.

Both refusals throw InvalidOperationException with a message that says what to do. UseClaudaliskModuleSchema also throws when AddClaudaliskPersistence was not called.

Migrations

DatabaseInitializer.MigrateAsync moves migration histories, adopts baselines, then migrates each context in registration order. GetPendingMigrationsAsync lists what is pending as schema: migration. GetMigrations lists every migration of every context, applied or not, as ModuleMigration(Schema, Id) in registration order, so a host can print them without touching EF Core types.

Call MigrateAsync outside a unit of work. Migrations manage their own transactions, so inside RunAsync it throws InvalidOperationException.

AddClaudaliskMigrationBaseline(schema, migration, replaces) and AddClaudaliskMovedMigrationHistory(from, to) support resetting a module's migrations and moving tables out of a shared context. Both change history that was already applied, so follow the migration runbooks and get the owner's approval first.

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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Claudalisk.Persistence:

Package Downloads
Claudalisk.Jobs.PostgreSql

The PostgreSQL transport of Claudalisk.Jobs: the jobs table, FOR UPDATE SKIP LOCKED claims and LISTEN/NOTIFY.

Claudalisk.Scheduling

Cron schedules from configuration that queue commands as jobs of the scheduler's own jobs module, once per scheduled time.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-alpha.5 87 11/24/2026
0.1.0-alpha.4 161 11/22/2026
0.1.0-alpha.3 84 11/22/2026
0.1.0-alpha.2 77 11/21/2026
0.1.0-alpha.1 673 11/8/2026