Table of Contents

Method ExecuteTransaction

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.Core.dll

ExecuteTransaction<T>(DbConnection, Func<DbTransaction, T>, IsolationLevel, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions and the optional provided token is not cancelled. Otherwise rolls-back the transaction.

public static T ExecuteTransaction<T>(this DbConnection connection, Func<DbTransaction, T> action, IsolationLevel isolationLevel = IsolationLevel.Unspecified, CancellationToken cancellationToken = default)

Parameters

connection DbConnection

The connection to transact with.

action Func<DbTransaction, T>

The handler to execute while a transaction is pending.

isolationLevel IsolationLevel

The isolation level for the transaction.

cancellationToken CancellationToken

A token that if cancelled will cause this transaction to be aborted or rolled-back.

Returns

T

The value of the action.

Type Parameters

T

The value returned from the action.

ExecuteTransaction(DbConnection, Action<DbTransaction>, IsolationLevel, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions and the optional provided token is not cancelled. Otherwise rolls-back the transaction.

public static void ExecuteTransaction(this DbConnection connection, Action<DbTransaction> action, IsolationLevel isolationLevel = IsolationLevel.Unspecified, CancellationToken cancellationToken = default)

Parameters

connection DbConnection

The connection to transact with.

action Action<DbTransaction>

The handler to execute while a transaction is pending.

isolationLevel IsolationLevel

The isolation level for the transaction.

cancellationToken CancellationToken

A token that if cancelled will cause this transaction to be aborted or rolled-back.

ExecuteTransaction<T>(DbConnection, Func<DbTransaction, T>, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions and the optional provided token is not cancelled. Otherwise rolls-back the transaction.

public static T ExecuteTransaction<T>(this DbConnection connection, Func<DbTransaction, T> action, CancellationToken cancellationToken)

Parameters

connection DbConnection

The connection to transact with.

action Func<DbTransaction, T>

The handler to execute while a transaction is pending.

cancellationToken CancellationToken

A token that if cancelled will cause this transaction to be aborted or rolled-back.

Returns

T

The value of the action.

Type Parameters

T

The value returned from the action.

ExecuteTransaction(DbConnection, Action<DbTransaction>, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions and the optional provided token is not cancelled. Otherwise rolls-back the transaction.

public static void ExecuteTransaction(this DbConnection connection, Action<DbTransaction> action, CancellationToken cancellationToken)

Parameters

connection DbConnection

The connection to transact with.

action Action<DbTransaction>

The handler to execute while a transaction is pending.

cancellationToken CancellationToken

A token that if cancelled will cause this transaction to be aborted or rolled-back.

ExecuteTransaction<T>(DbConnection, IsolationLevel, CancellationToken, Func<DbTransaction, T>)

Begins a transaction before executing the action. Commits if there are no exceptions. Otherwise rolls-back the transaction.

public static T ExecuteTransaction<T>(this DbConnection connection, IsolationLevel isolationLevel, CancellationToken cancellationToken, Func<DbTransaction, T> action)

Parameters

connection DbConnection

The connection to transact with.

isolationLevel IsolationLevel

The isolation level for the transaction.

cancellationToken CancellationToken

A token that if cancelled will cause this transaction to be aborted or rolled-back.

action Func<DbTransaction, T>

The handler to execute while a transaction is pending.

Returns

T

The value of the action.

Type Parameters

T

The value returned from the action.

ExecuteTransaction(DbConnection, IsolationLevel, CancellationToken, Action<DbTransaction>)

Begins a transaction before executing the action. Commits if there are no exceptions. Otherwise rolls-back the transaction.

public static void ExecuteTransaction(this DbConnection connection, IsolationLevel isolationLevel, CancellationToken cancellationToken, Action<DbTransaction> action)

Parameters

connection DbConnection

The connection to transact with.

isolationLevel IsolationLevel

The isolation level for the transaction.

cancellationToken CancellationToken

A token that if cancelled will cause this transaction to be aborted or rolled-back.

action Action<DbTransaction>

The handler to execute while a transaction is pending.

ExecuteTransaction<T>(DbConnection, IsolationLevel, Func<DbTransaction, T>, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions. Otherwise rolls-back the transaction.

public static T ExecuteTransaction<T>(this DbConnection connection, IsolationLevel isolationLevel, Func<DbTransaction, T> action, CancellationToken cancellationToken = default)

Parameters

connection DbConnection

The connection to transact with.

isolationLevel IsolationLevel

The isolation level for the transaction.

action Func<DbTransaction, T>

The handler to execute while a transaction is pending.

cancellationToken CancellationToken

An optional token that if cancelled will cause this transaction to be aborted or rolled-back.

Returns

T

The value of the action.

Type Parameters

T

The value returned from the action.

ExecuteTransaction(DbConnection, IsolationLevel, Action<DbTransaction>, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions. Otherwise rolls-back the transaction.

public static void ExecuteTransaction(this DbConnection connection, IsolationLevel isolationLevel, Action<DbTransaction> action, CancellationToken cancellationToken = default)

Parameters

connection DbConnection

The connection to transact with.

isolationLevel IsolationLevel

The isolation level for the transaction.

action Action<DbTransaction>

The handler to execute while a transaction is pending.

cancellationToken CancellationToken

An optional token that if cancelled will cause this transaction to be aborted or rolled-back.

ExecuteTransaction<T>(DbConnection, CancellationToken, Func<DbTransaction, T>)

Begins a transaction before executing the action. Commits if there are no exceptions and the optional provided token is not cancelled. Otherwise rolls-back the transaction.

public static T ExecuteTransaction<T>(this DbConnection connection, CancellationToken cancellationToken, Func<DbTransaction, T> action)

Parameters

connection DbConnection

The connection to transact with.

cancellationToken CancellationToken

A token that if cancelled will cause this transaction to be aborted or rolled-back.

action Func<DbTransaction, T>

The handler to execute while a transaction is pending.

Returns

T

The value of the action.

Type Parameters

T

The value returned from the action.

ExecuteTransaction(DbConnection, CancellationToken, Action<DbTransaction>)

Begins a transaction before executing the action. Commits if there are no exceptions and the optional provided token is not cancelled. Otherwise rolls-back the transaction.

public static void ExecuteTransaction(this DbConnection connection, CancellationToken cancellationToken, Action<DbTransaction> action)

Parameters

connection DbConnection

The connection to transact with.

cancellationToken CancellationToken

A token that if cancelled will cause this transaction to be aborted or rolled-back.

action Action<DbTransaction>

The handler to execute while a transaction is pending.