Interface IUnitOfWorkManager
- Namespace
- Cratis.Chronicle.Transactions
- Assembly
- Cratis.Chronicle.dll
Defines a system that can manage units of work.
public interface IUnitOfWorkManager
Properties
Current
Gets the current IUnitOfWork, scoped to the current async context.
IUnitOfWork Current { get; }
Property Value
Exceptions
- NoUnitOfWorkHasBeenStarted
If no unit of work has been started.
HasCurrent
Gets a value indicating whether or not there is a current IUnitOfWork.
bool HasCurrent { get; }
Property Value
Methods
Begin(CorrelationId)
Begin a new IUnitOfWork with a specific CorrelationId for the current async context.
IUnitOfWork Begin(CorrelationId correlationId)
Parameters
correlationId
CorrelationIdThe CorrelationId to use for the IUnitOfWork.
Returns
- IUnitOfWork
A new IUnitOfWork.
SetCurrent(IUnitOfWork)
Set the current IUnitOfWork.
void SetCurrent(IUnitOfWork unitOfWork)
Parameters
unitOfWork
IUnitOfWorkThe IUnitOfWork to set as current.
TryGetFor(CorrelationId, out IUnitOfWork)
Try to get the IUnitOfWork for a specific CorrelationId.
bool TryGetFor(CorrelationId correlationId, out IUnitOfWork unitOfWork)
Parameters
correlationId
CorrelationIdThe CorrelationId to get the IUnitOfWork for.
unitOfWork
IUnitOfWorkThe IUnitOfWork if it was found, otherwise null.
Returns
- bool
True if it was found, false if not.