Interface IUnitOfWork
Represents a unit of work for coordinating database operations within a transaction.
public interface IUnitOfWork : IAsyncDisposable
- Inherited Members
Properties
Connection
Gets the underlying database connection.
IDbConnection Connection { get; }
Property Value
- IDbConnection
The underlying database connection.
Transaction
Gets the current database transaction if one has been started.
IDbTransaction? Transaction { get; }
Property Value
- IDbTransaction
The current database transaction if one has been started.
Methods
BeginTransactionAsync(CancellationToken)
Begins a new transaction on the connection.
Task BeginTransactionAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation token for the operation.
Returns
CommitAsync(CancellationToken)
Commits the active transaction.
Task CommitAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation token for the operation.
Returns
RollbackAsync(CancellationToken)
Rolls back the active transaction.
Task RollbackAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation token for the operation.