⚠ Deprecated: Legacy
Suggested alternative: Shuttle.Core.TransactionScope
Transaction adapter.
$ dotnet add package Shuttle.Core.TransactionsPM> Install-Package Shuttle.Core.Transactions
This package makes use of the .Net TransactionScope class to provide ambient transaction handling.
The relevant components may be configured using IServiceColletion:
services.AddTransactionScope(builder =>
{
builder.Options.Enabled = true;
builder.Options.IsolationLevel = isolationLevel;
builder.Options.Timeout = TimeSpan.FromSeconds(30);
});
The default JSON settings structure is as follows::
{
"Shuttle": {
"TransactionScope": {
"Enabled": true,
"IsolationLevel": "isolation-level",
"Timeout": "00:00:30"
}
}
}
An implementation of the ITransactionScope interface is used to wrap a TransactionScope.
The DefaultTransactionScope makes use of the standard .NET TransactionScope functionality. There is also a NullTransactionScope that implements the null pattern so it implements the interface but does not do anything.
Guid Id { get; }
Returns the Id of the transaction scope.
void Complete();
Marks the transaction scope as complete.
An implementation of the ITransactionScopeFactory interface provides instances of an ITransactionScope implementation.
The TransactionScopeFactory provides a DefaultTransactionScope instance if transaction scopes are Enabled; else a NullTransactionScope that implements the null pattern.
ITransactionScope Create(IsolationLevel isolationLevel, TimeSpan timeout);
Creates the relevant instance using the given parameters.