Cogito.MassTransit.EntityFrameworkCore.DependencyInjection 3.1.0

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

Cogito.MassTransit.EntityFrameworkCore.DependencyInjection

Keeps MassTransit saga instances in Entity Framework Core, registered from an attribute on the saga.

Install

dotnet add package Cogito.MassTransit.EntityFrameworkCore.DependencyInjection

Use

Apply [EntityFrameworkSagaRepository] to a saga, or a saga state machine, registered with Cogito.MassTransit.DependencyInjection, naming the DbContext that maps the saga:

[AddSagaStateMachine(EndpointName = "order-state")]
[EntityFrameworkSagaRepository(typeof(OrderDbContext))]
public class OrderStateMachine : MassTransitStateMachine<OrderState> { ... }

The DbContext must be registered in the container, for instance with services.AddDbContext<OrderDbContext>(...), and must map the saga's instance type.

The attribute takes:

  • ConcurrencyMode: Pessimistic, the default, locks an instance when it is loaded; Optimistic checks it for changes when it is saved.

  • IsolationLevel of the transaction: unless set, Serializable for pessimistic and ReadCommitted for optimistic.

  • LockStatementProvider, MassTransit's ILockStatementProvider whose statement locks pessimistic instances when they are loaded. Unless set, it is MassTransit's default, for SQL Server. On another database, name its provider:

    [EntityFrameworkSagaRepository(typeof(OrderDbContext), LockStatementProvider = typeof(PostgresLockStatementProvider))]
    

    The provider is created with a constructor whose parameters are all optional, as MassTransit's providers have. For a schema other than the DbContext's default, derive a provider that passes it to the base constructor.

The repository is registered directly, so it does not depend on whether the attributes are added before or after AddMassTransit.

License

MIT.

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 was computed.  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
3.1.0 43 10/15/2026