Bsft.Messaging.EFCore 2.2.0

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

Bsft.Messaging.EFCore

The durable half of the Bsft.Messaging family: the transactional outbox written by an EF Core interceptor in the same SaveChanges as the state change, the leasing dispatcher store behind it, and the inbox whose mark commits together with what the handlers wrote.

Install

dotnet add package Bsft.Messaging.EFCore

Requires Bsft.Messaging (and its abstractions transitively), Bsft.Core for the polling loop, and Microsoft.EntityFrameworkCore with Microsoft.EntityFrameworkCore.Relational. The application's own DbContext implements IOutboxDbContext and IInboxDbContext; that is the whole point of this package, because a row in the application's context is a row in the application's transaction.

Register

services.AddBsftMessaging(configuration, o => o.AddEvent<OrderPlaced>("orders.placed.v1"));

// producing side: interceptor, leasing store and the dispatcher
services.AddBsftMessagingEFCore<AppDbContext>(outbox => outbox.PollInterval = TimeSpan.FromSeconds(2));

// consuming side: the durable inbox and its pruner, before AddBsftConsumerHost
services.AddBsftInboxEFCore<AppDbContext>();
services.AddBsftConsumerHost(consumer => consumer.ConsumerName = "orders");

Two more things are required. The interceptor has to be added to the context — options.AddInterceptors(sp.GetRequiredService<OutboxInterceptor>()) — or staged events are silently never written; and OutboxMessageEntityConfiguration and InboxMessageEntityConfiguration have to be applied in OnModelCreating with a migration for the OutboxMessages and InboxMessages tables. AddBsftOutbox<TContext> registers the staging side alone, for a host where another component owns delivery. AddBsftInboxEFCore must come before AddBsftConsumerHost, which registers the in-memory inbox with TryAdd; getting that order wrong is not loud, the consumer simply forgets what it has processed on every restart.

Configure

This package has no options type of its own. AddBsftMessagingEFCore configures BsftMessagingOptions.Outbox and the inbox pruner reads BsftMessagingOptions.Consumer.InboxRetention, both documented in Bsft.Messaging and bound from section Bsft:Messaging. The two column widths a host may need when writing a migration by hand are OutboxMessageEntityConfiguration.EventTypeNameMaxLength (500), OutboxMessageEntityConfiguration.FailureReasonMaxLength (1000, the shared MessageReasonLimits.MaxReasonLength), OutboxMessageEntityConfiguration.CorrelationIdMaxLength (200), InboxMessageEntityConfiguration.ConsumerMaxLength (200) and InboxMessageEntityConfiguration.EventNameMaxLength (500).

Validation: none of its own; the shared messaging options are validated by ValidateOnStart(), and the pruner additionally refuses a retention that is set and not positive when it is constructed outside the container.

Extend

IOutboxDbContext and IInboxDbContext are the two seams this package declares, and they stay here rather than in Bsft.Messaging.Abstractions because their signatures name DbSet<>, which that package's dependency closure does not allow. Implement them on the application's DbContext; that is the only extension point this package expects a host to use.

Everything else it supplies is a default implementation of a contract declared in Bsft.Messaging.Abstractions: EFCoreOutboxStore for IOutboxStore, whose every state transition is one conditional statement so the database settles the race between two instances, and EFCoreInboxStore for IInboxStore, which stages the mark on the handlers' own context so one SaveChanges commits both. OutboxInterceptor and InboxSweeper are concrete by design and are replaced by not registering them.

Documentation

Topic page: docs/messaging.md. Conventions: docs/package-conventions.md.

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 (1)

Showing the top 1 NuGet packages that depend on Bsft.Messaging.EFCore:

Package Downloads
Bsft.Messaging.EFCore.Postgres

BSFT Framework PostgreSQL LISTEN/NOTIFY wake-up for the Bsft.Messaging EF Core outbox: the dispatcher drains on commit instead of waiting for its next poll.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.0 105 10/23/2026
2.1.0 134 9/28/2026