Table of Contents

Interface IUnitOfWork

Namespace
Excalibur.Data
Assembly
Excalibur.Data.Abstractions.dll

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

cancellationToken CancellationToken

The cancellation token for the operation.

Returns

Task

A Task representing the asynchronous operation.

CommitAsync(CancellationToken)

Commits the active transaction.

Task CommitAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation token for the operation.

Returns

Task

A Task representing the asynchronous operation.

RollbackAsync(CancellationToken)

Rolls back the active transaction.

Task RollbackAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation token for the operation.

Returns

Task

A Task representing the asynchronous operation.