UKBatch.Storage.EntityFrameworkCore 0.2.1-alpha

This is a prerelease version of UKBatch.Storage.EntityFrameworkCore.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package UKBatch.Storage.EntityFrameworkCore --version 0.2.1-alpha
                    
NuGet\Install-Package UKBatch.Storage.EntityFrameworkCore -Version 0.2.1-alpha
                    
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="UKBatch.Storage.EntityFrameworkCore" Version="0.2.1-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UKBatch.Storage.EntityFrameworkCore" Version="0.2.1-alpha" />
                    
Directory.Packages.props
<PackageReference Include="UKBatch.Storage.EntityFrameworkCore" />
                    
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 UKBatch.Storage.EntityFrameworkCore --version 0.2.1-alpha
                    
#r "nuget: UKBatch.Storage.EntityFrameworkCore, 0.2.1-alpha"
                    
#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 UKBatch.Storage.EntityFrameworkCore@0.2.1-alpha
                    
#: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=UKBatch.Storage.EntityFrameworkCore&version=0.2.1-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=UKBatch.Storage.EntityFrameworkCore&version=0.2.1-alpha&prerelease
                    
Install as a Cake Tool

UKBatch.Storage.EntityFrameworkCore

EF Core 10 persistent storage adapter for UKBatch — a plug-in replacement for the in-memory stores so batch definitions, execution history, and pending approval records survive a host restart. Supports PostgreSQL (Npgsql) and SQLite.

Status: part of the UKBatch 0.1.0-alpha package family.

Install

dotnet add package UKBatch.Storage.EntityFrameworkCore

Quick start

Register the EF stores after AddUKBatch — this replaces the default in-memory stores. No other code changes: your jobs, batches, REST API, and dashboard keep working — only where the state lives changes.

services.AddUKBatch(b => b.AddJob<MyJob>())
        .AddUKBatchEntityFrameworkCoreStores(o => o.UsePostgres(
            "Host=localhost;Database=ukbatch;Username=ukbatch;Password=…"));

// or SQLite (a single file — great for a single-node deployment or local dev):
//     .AddUKBatchEntityFrameworkCoreStores(o => o.UseSqlite("Data Source=ukbatch.db"));

Provider selection is exclusive — one provider per deployment. Calling both UsePostgres and UseSqlite is last-wins.

Try the storage swap

Sample.RestApi exposes a --storage flag so you can watch the exact same app run on each store:

dotnet run --project samples/Sample.RestApi -- --storage inmemory      # default (volatile)
dotnet run --project samples/Sample.RestApi -- --storage ef-sqlite      # DataSource=ukbatch-sample.db
dotnet run --project samples/Sample.RestApi -- --storage ef-pg \
    --storage-connection "Host=localhost;Database=ukbatch;Username=…;Password=…"

samples/Sample.RestApi/smoke-restart-sqlite.sh triggers a batch, pauses it at an approval gate, kill -9s the process, restarts over the same .db file, and shows the pending approval + execution history still there.

Migrations

The package ships design-time migrations for both providers under Migrations/Postgres and Migrations/Sqlite. Apply them in one of two ways:

  • Production (recommended): dotnet ef database update -c UKBatchDbContext (ops controls schema).
  • Dev/demo: set o.MigrateOnStartup = true to apply pending migrations at boot.

EnsureCreated() is not supported (no migration history, not evolvable).

Durability boundary

This package delivers durable record + re-decidability + orphan cleanup, not durable workflow resume. After a restart: execution history persists, batch definitions are intact, and a pending approval gate survives as a re-decidable record — but the batch it paused does not auto-resume, and its in-flight executions are reaped to Failed. Mid-flight resume is a v0.2 concern.

The OrphanGracePeriod (default 2 min) is the window an interrupted, non-terminal execution is given before the reaper marks it Failed — long enough to cover a normal graceful restart in flight. Set it to TimeSpan.Zero to disable the reaper.

Schema versioning

The 0.1.0-alpha schema is the Initial migration for each provider. Forward-compatible columns (Parameters/Steps JSON, BatchDefinitionId, SourceService/TargetService) are already in place, so v0.2 additive changes ship as new migrations you apply with dotnet ef database update. Enums inside JSON columns are stored as names (not ordinals), so a v0.2 reader round-trips a v0.1 blob.

License

MIT. See LICENSE in the repo root. Full docs: nspukcode-hub.github.io/UKBatch · GitHub.

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
0.2.2-alpha 58 6/18/2026
0.2.1-alpha 51 6/15/2026
0.2.0-alpha 54 6/14/2026
0.1.6-alpha 53 6/13/2026
0.1.5-alpha 51 6/12/2026
0.1.4-alpha 54 6/10/2026
0.1.3-alpha 57 6/8/2026
0.1.1-alpha 55 6/8/2026
0.1.0-alpha 60 6/6/2026