Innovabit.DotNet.Interceptors.Transactions.EntityFrameworkCore
3.0.135
See the version list below for details.
dotnet add package Innovabit.DotNet.Interceptors.Transactions.EntityFrameworkCore --version 3.0.135
NuGet\Install-Package Innovabit.DotNet.Interceptors.Transactions.EntityFrameworkCore -Version 3.0.135
<PackageReference Include="Innovabit.DotNet.Interceptors.Transactions.EntityFrameworkCore" Version="3.0.135" />
<PackageVersion Include="Innovabit.DotNet.Interceptors.Transactions.EntityFrameworkCore" Version="3.0.135" />
<PackageReference Include="Innovabit.DotNet.Interceptors.Transactions.EntityFrameworkCore" />
paket add Innovabit.DotNet.Interceptors.Transactions.EntityFrameworkCore --version 3.0.135
#r "nuget: Innovabit.DotNet.Interceptors.Transactions.EntityFrameworkCore, 3.0.135"
#:package Innovabit.DotNet.Interceptors.Transactions.EntityFrameworkCore@3.0.135
#addin nuget:?package=Innovabit.DotNet.Interceptors.Transactions.EntityFrameworkCore&version=3.0.135
#tool nuget:?package=Innovabit.DotNet.Interceptors.Transactions.EntityFrameworkCore&version=3.0.135
Innovabit.DotNet.Interceptors.Transactions.EntityFrameworkCore
Entity Framework Core provider for
Innovabit.DotNet.Interceptors.Transactions.Abstractions:
[Transactional] methods run inside a transaction opened on your DbContext's own connection, so
every SaveChanges they make takes part in it.
Usage
services.AddDbContext<OrderDbContext>(o => o.UseSqlServer(connectionString));
services
.AddInterceptors()
.AddEntityFrameworkCoreTransactions<OrderDbContext>();
services.AddScopedWithInterception<IOrderService, OrderService>();
public class OrderService(OrderDbContext db, IInventoryService inventory) : IOrderService
{
[Transactional]
public async Task PlaceAsync(Order order, CancellationToken cancellationToken)
{
db.Orders.Add(order);
await db.SaveChangesAsync(cancellationToken);
// Joins the same transaction: nothing is persisted unless both steps succeed.
await inventory.ReserveAsync(order.Lines, cancellationToken);
}
}
The DbContext must be registered with a scoped lifetime (what AddDbContext does by default),
so the interceptor and the intercepted method share the same connection.
Provider notes
[Transactional] property |
Behaviour here |
|---|---|
Propagation |
Required, Supports, Mandatory and Never work as documented. RequiresNew throws NotSupportedException when a transaction is already in progress — a DbContext holds one connection, which cannot carry two independent transactions. Use the SystemTransactions provider, or a second DbContext. |
IsolationLevel |
Passed straight to Database.BeginTransaction(IsolationLevel). |
TimeoutSeconds |
EF Core has no transaction timeout, so it is applied as the command timeout for the statements issued inside the transaction. The context's previous command timeout is restored afterwards. |
ReadOnly |
The transaction is opened and then rolled back instead of committed. Tracking behaviour is left untouched. |
Retrying execution strategies
With a retrying execution strategy (EnableRetryOnFailure), EF Core refuses transactions opened
outside it, so the whole [Transactional] method runs inside it and is run again after a
transient failure, on a cleared change tracker. Keep in mind:
- Anything else the method does (an e-mail, an HTTP call) happens again too.
- The commit is not retried: if the connection is lost while committing, it may have gone through, and running the method again would do the work twice. That failure reaches the caller.
- If the context was already tracking entities when the method was called, they would be lost, so it
fails with an
InvalidOperationExceptioninstead of retrying. The first attempt is not affected. - Once the strategy gives up, the caller gets EF Core's
RetryLimitExceededException.
License
MIT
| Product | Versions 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. |
-
net10.0
- Innovabit.DotNet.Interceptors.Transactions.Abstractions (>= 3.0.135)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.15)
-
net11.0
- Innovabit.DotNet.Interceptors.Transactions.Abstractions (>= 3.0.135)
- Microsoft.EntityFrameworkCore.Relational (>= 11.0.0)
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.0.136 | 47 | 12/5/2026 |
| 3.0.135 | 105 | 11/30/2026 |
| 3.0.134 | 97 | 11/30/2026 |
| 3.0.133 | 85 | 11/30/2026 |
| 3.0.132 | 90 | 11/30/2026 |
| 3.0.129 | 89 | 11/30/2026 |
| 3.0.128 | 94 | 11/30/2026 |
| 3.0.127 | 106 | 11/30/2026 |
| 3.0.126 | 106 | 11/30/2026 |
| 3.0.125 | 107 | 11/30/2026 |
| 3.0.124 | 104 | 11/28/2026 |
| 3.0.123 | 98 | 11/28/2026 |
| 3.0.122 | 116 | 11/21/2026 |
| 2.0.121 | 91 | 11/21/2026 |
| 2.0.120 | 101 | 11/21/2026 |
| 2.0.119 | 117 | 11/14/2026 |
| 2.0.118 | 119 | 11/7/2026 |
| 2.0.117 | 122 | 10/31/2026 |
| 2.0.116 | 113 | 10/26/2026 |
| 2.0.115 | 121 | 10/17/2026 |