Table of Contents

Class TransactionScope

Namespace
CL.MySQL2.Services
Assembly
CL.MySQL2.dll

Wraps a MySqlConnector.MySqlTransaction with an async-disposable pattern. When disposed without an explicit CommitAsync(CancellationToken) or RollbackAsync(CancellationToken) call, the transaction is automatically rolled back.

public sealed class TransactionScope : IAsyncDisposable
Inheritance
TransactionScope
Implements
Inherited Members

Methods

CommitAsync(CancellationToken)

Commits the transaction.

public Task CommitAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task

Exceptions

InvalidOperationException

Thrown if already committed or rolled back.

DisposeAsync()

Disposes the transaction. Automatically rolls back if not already committed/rolled back.

public ValueTask DisposeAsync()

Returns

ValueTask

RollbackAsync(CancellationToken)

Rolls back the transaction explicitly.

public Task RollbackAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task

Exceptions

InvalidOperationException

Thrown if already committed or rolled back.