Class CloudStorageTransactionManager
- Namespace
- CloudStorageORM.Infrastructure
- Assembly
- CloudStorageORM.dll
Transaction manager that stages object-storage operations and optionally persists a durable journal.
public class CloudStorageTransactionManager : IDbContextTransactionManager, IResettableService
- Inheritance
-
CloudStorageTransactionManager
- Implements
- Inherited Members
Constructors
CloudStorageTransactionManager()
Creates a transaction manager without durable journal support.
public CloudStorageTransactionManager()
CloudStorageTransactionManager(IStorageProvider)
Creates a transaction manager with durable journal support backed by object storage.
public CloudStorageTransactionManager(IStorageProvider storageProvider)
Parameters
storageProviderIStorageProviderStorage provider used to persist transaction manifests.
Properties
CurrentTransaction
Gets the current transaction.
public IDbContextTransaction? CurrentTransaction { get; }
Property Value
Methods
BeginTransaction()
Begins a new transaction.
public IDbContextTransaction BeginTransaction()
Returns
- IDbContextTransaction
The newly created transaction.
BeginTransactionAsync(CancellationToken)
Asynchronously begins a new transaction.
public Task<IDbContextTransaction> BeginTransactionAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA CancellationToken to observe while waiting for the task to complete.
Returns
- Task<IDbContextTransaction>
A task that represents the asynchronous operation. The task result contains the newly created transaction.
Exceptions
- OperationCanceledException
If the CancellationToken is canceled.
CommitTransaction()
Commits all changes made to the database in the current transaction.
public void CommitTransaction()
CommitTransactionAsync(CancellationToken)
Commits all changes made to the database in the current transaction.
public Task CommitTransactionAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA CancellationToken to observe while waiting for the task to complete.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- OperationCanceledException
If the CancellationToken is canceled.
ResetState()
Resets the service so that it can be used from the pool.
public void ResetState()
ResetStateAsync(CancellationToken)
Resets the service so that it can be used from the pool.
public Task ResetStateAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA CancellationToken to observe while waiting for the task to complete.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- OperationCanceledException
If the CancellationToken is canceled.
RollbackTransaction()
Discards all changes made to the database in the current transaction.
public void RollbackTransaction()
RollbackTransactionAsync(CancellationToken)
Discards all changes made to the database in the current transaction.
public Task RollbackTransactionAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA CancellationToken to observe while waiting for the task to complete.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- OperationCanceledException
If the CancellationToken is canceled.