OrionPatch.EntityFrameworkCore 0.2.0

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

OrionPatch.EntityFrameworkCore

EF Core storage backend for OrionPatch. Adds the OrionPatch_Outbox table with provider-aware competing-consumers claim and a SaveChangesInterceptor that flushes buffered messages into your transaction.

30-second quick start

services.AddDbContext<AppDbContext>((sp, options) =>
{
    options.UseNpgsql(connectionString);
    options.UseOrionPatch(sp);   // hook the interceptor into your DbContext
});

services.AddOrionPatch()
    .UseEntityFrameworkCore<AppDbContext>()
    .UseSink<MyKafkaSink>();

In your DbContext.OnModelCreating:

protected override void OnModelCreating(ModelBuilder modelBuilder) =>
    modelBuilder.ApplyOrionPatchConfiguration();

Enqueue from service code:

_outbox.Enqueue(new OrderConfirmed(orderId, totalCents));
await _db.SaveChangesAsync(ct);   // outbox row commits with your other entity changes

What's in the box

  • OutboxEntityConfiguration — maps OutboxRow to OrionPatch_Outbox with covering indexes for the dispatcher's polling and lease-expiry queries.
  • EfCoreOutboxIOutbox that buffers per-DbContext and binds via ConditionalWeakTable so the interceptor finds the right buffer without a service-provider hop.
  • OrionPatchSaveChangesInterceptor — six-override lifecycle (Saving / Saved / SaveChangesFailed and their async siblings) implementing a three-phase Flush / Commit / Revert so save failures re-buffer cleanly without double-inserting on retry.
  • EfCoreOutboxStorage — claim/complete/fail/dead-letter via ExecuteUpdateAsync single round-trips.
  • Provider-aware claim strategy:
    • SqlServer / PostgreSQL / MySQL — SkipLockedClaimStrategy with dialect-specific SQL. (v0.1.0 currently delegates these to the portable fallback; true SKIP LOCKED SQL lands in v0.2.)
    • SQLite + unknown providers — CompareAndSwapClaimStrategy (portable optimistic-concurrency claim).

Multi-DbContext

v0.1.0 supports one OrionPatch-bound DbContext per host. Calling UseEntityFrameworkCore<TDbContext> twice silently overrides the previous registration's IOutbox and IOutboxStorage services. First-class multi-DbContext support is on the v0.2 roadmap.

See the repo README for the full picture.

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 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. 
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.0 16 6/3/2026
0.1.1 126 5/25/2026
0.1.0 80 5/24/2026