Reyrb.Database.Transactions
10.0.0
dotnet add package Reyrb.Database.Transactions --version 10.0.0
NuGet\Install-Package Reyrb.Database.Transactions -Version 10.0.0
<PackageReference Include="Reyrb.Database.Transactions" Version="10.0.0" />
<PackageVersion Include="Reyrb.Database.Transactions" Version="10.0.0" />
<PackageReference Include="Reyrb.Database.Transactions" />
paket add Reyrb.Database.Transactions --version 10.0.0
#r "nuget: Reyrb.Database.Transactions, 10.0.0"
#:package Reyrb.Database.Transactions@10.0.0
#addin nuget:?package=Reyrb.Database.Transactions&version=10.0.0
#tool nuget:?package=Reyrb.Database.Transactions&version=10.0.0
Reyrb.Database.Transactions
Requires .NET 10 and EF Core 10.
await using var transaction = await context.BeginOrJoinTransactionAsync();
// Make changes using context.
await context.SaveChangesAsync();
await transaction.CompleteAsync();
Auto joins the context's existing EF transaction or the ambient transaction, if present.
Otherwise it starts an EF transaction. An explicit TransactionMethod requires a compatible
existing transaction or creates one using that mechanism.
The isolation level applies only when creating a transaction. Joining accepts the existing isolation level, regardless of the requested value.
Only an owning handle controls the transaction. Completing or disposing a joined handle has no effect on the outer transaction. Joining creates no savepoint and does not prevent an outer commit after a caught inner exception. The owner decides whether to commit or roll back.
An owned EF transaction commits in CompleteAsync. An owned TransactionScope is marked
complete by CompleteAsync and commits on disposal. Disposing either without completing rolls
back. CompleteAsync does not call SaveChangesAsync.
Ambient transactions
await using var transaction = await context.BeginOrJoinTransactionAsync(
TransactionMethod.TransactionScope);
await context.SaveChangesAsync();
await transaction.CompleteAsync();
Call the factory directly from the method that uses and disposes the scope. Do not wrap it in
another async factory that returns the handle: execution context changes made inside an async
method do not flow back to its caller. The factory intentionally has no async modifier; only
the EF creation helper awaits internally. The ambient transaction flows across awaits in the
calling method. Dispose handles in reverse creation order, as with ordinary TransactionScope.
The provider must support System.Transactions. await using forwards asynchronous disposal
to EF transactions. Transaction scopes dispose synchronously, even through DisposeAsync,
because TransactionScope has no asynchronous commit or disposal API. New scopes use
TransactionManager.DefaultTimeout.
API changes
IDbTransaction now also implements IAsyncDisposable. If you implement this interface,
provide DisposeAsync. Both public wrapper constructors now require a non-null transaction;
use BeginOrJoinTransactionAsync to obtain a joined handle. Argument and transaction-method
validation failures are thrown synchronously by the factory.
Run the transaction tests with:
dotnet test Reyrb.Database.Transactions.Tests --configuration Release
| 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. |
-
net10.0
- Microsoft.EntityFrameworkCore (>= 10.0.12)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.12)
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 |
|---|