Table of Contents

Class SqlTransactionExtensions

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.MSSqlClient.dll

Microsoft.Data.SqlClient specific extensions for database transactions.

[SuppressMessage("Design", "CA1068:CancellationToken parameters must come last", Justification = "Overload for easier consumption.")]
public static class SqlTransactionExtensions
Inheritance
SqlTransactionExtensions
Inherited Members

Methods

CreateCommand(SqlTransaction, CommandType, string, int)

Creates a SqlCommand enlisted in a transaction, on the transaction's connection, with the command type, text, and timeout already set.

CreateStoredProcedureCommand(SqlTransaction, string, int)

Creates a stored procedure SqlCommand enlisted in a transaction.

CreateTextCommand(SqlTransaction, string, int)

Creates a text SqlCommand enlisted in a transaction.

ExecuteTransaction(SqlConnection, Action<SqlTransaction>, 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.

ExecuteTransaction(SqlConnection, Action<SqlTransaction>, 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.

ExecuteTransaction(SqlConnection, IsolationLevel, Action<SqlTransaction>, CancellationToken)

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

ExecuteTransaction(SqlConnection, IsolationLevel, CancellationToken, Action<SqlTransaction>)

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

ExecuteTransaction(SqlConnection, CancellationToken, Action<SqlTransaction>)

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.

ExecuteTransactionAsync(SqlConnection, IsolationLevel, Func<SqlTransaction, ValueTask>, CancellationToken)

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

ExecuteTransactionAsync(SqlConnection, IsolationLevel, CancellationToken, Func<SqlTransaction, ValueTask>)

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

ExecuteTransactionAsync(SqlConnection, Func<SqlTransaction, ValueTask>, 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.

ExecuteTransactionAsync(SqlConnection, Func<SqlTransaction, ValueTask>, 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.

ExecuteTransactionAsync(SqlConnection, CancellationToken, Func<SqlTransaction, ValueTask>)

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.

ExecuteTransactionAsync<T>(SqlConnection, IsolationLevel, Func<SqlTransaction, ValueTask<T>>, CancellationToken)

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

ExecuteTransactionAsync<T>(SqlConnection, IsolationLevel, CancellationToken, Func<SqlTransaction, ValueTask<T>>)

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

ExecuteTransactionAsync<T>(SqlConnection, Func<SqlTransaction, ValueTask<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.

ExecuteTransactionAsync<T>(SqlConnection, Func<SqlTransaction, ValueTask<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.

ExecuteTransactionAsync<T>(SqlConnection, CancellationToken, Func<SqlTransaction, ValueTask<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.

ExecuteTransactionConditional(SqlConnection, IsolationLevel, Func<SqlTransaction, bool>, CancellationToken)

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

ExecuteTransactionConditional(SqlConnection, IsolationLevel, CancellationToken, Func<SqlTransaction, bool>)

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

ExecuteTransactionConditional(SqlConnection, Func<SqlTransaction, bool>, IsolationLevel, CancellationToken)

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

ExecuteTransactionConditional(SqlConnection, Func<SqlTransaction, bool>, CancellationToken)

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

ExecuteTransactionConditional(SqlConnection, CancellationToken, Func<SqlTransaction, bool>)

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

ExecuteTransactionConditionalAsync(SqlConnection, IsolationLevel, Func<SqlTransaction, ValueTask<bool>>, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions and the value from the action is true. Otherwise rolls-back the transaction.

ExecuteTransactionConditionalAsync(SqlConnection, IsolationLevel, CancellationToken, Func<SqlTransaction, ValueTask<bool>>)

Begins a transaction before executing the action. Commits if there are no exceptions and the value from the action is true. Otherwise rolls-back the transaction.

ExecuteTransactionConditionalAsync(SqlConnection, Func<SqlTransaction, ValueTask<bool>>, IsolationLevel, CancellationToken)

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

ExecuteTransactionConditionalAsync(SqlConnection, Func<SqlTransaction, ValueTask<bool>>, CancellationToken)

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

ExecuteTransactionConditionalAsync(SqlConnection, CancellationToken, Func<SqlTransaction, ValueTask<bool>>)

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

ExecuteTransactionConditionalAsync<T>(SqlConnection, IsolationLevel, Func<SqlTransaction, ValueTask<(bool Commit, T Value)>>, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions and the 'Commit' value from the action is true. Otherwise rolls-back the transaction.

ExecuteTransactionConditionalAsync<T>(SqlConnection, IsolationLevel, CancellationToken, Func<SqlTransaction, ValueTask<(bool Commit, T Value)>>)

Begins a transaction before executing the action. Commits if there are no exceptions and the 'Commit' value from the action is true. Otherwise rolls-back the transaction.

ExecuteTransactionConditionalAsync<T>(SqlConnection, Func<SqlTransaction, CancellationToken, ValueTask<(bool Commit, T Value)>>, IsolationLevel, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions, the 'Commit' value from the action is true and the optional cancellation token has not been cancelled. Otherwise rolls-back the transaction.

ExecuteTransactionConditionalAsync<T>(SqlConnection, Func<SqlTransaction, CancellationToken, ValueTask<(bool Commit, T Value)>>, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions, the 'Commit' value from the action is true and the optional cancellation token has not been cancelled. Otherwise rolls-back the transaction.

ExecuteTransactionConditionalAsync<T>(SqlConnection, Func<SqlTransaction, ValueTask<(bool Commit, T Value)>>, IsolationLevel, CancellationToken)

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

ExecuteTransactionConditionalAsync<T>(SqlConnection, Func<SqlTransaction, ValueTask<(bool Commit, T Value)>>, CancellationToken)

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

ExecuteTransactionConditionalAsync<T>(SqlConnection, CancellationToken, Func<SqlTransaction, ValueTask<(bool Commit, T Value)>>)

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

ExecuteTransactionConditional<T>(SqlConnection, IsolationLevel, Func<SqlTransaction, (bool Commit, T Value)>, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions and 'Commit' value from the action is true. Otherwise rolls-back the transaction.

ExecuteTransactionConditional<T>(SqlConnection, IsolationLevel, CancellationToken, Func<SqlTransaction, (bool Commit, T Value)>)

Begins a transaction before executing the action. Commits if there are no exceptions and 'Commit' value from the action is true. Otherwise rolls-back the transaction.

ExecuteTransactionConditional<T>(SqlConnection, Func<SqlTransaction, (bool Commit, T Value)>, IsolationLevel, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions, the 'Commit' value from the action is true and the optional cancellation token has not been cancelled. Otherwise rolls-back the transaction.

ExecuteTransactionConditional<T>(SqlConnection, Func<SqlTransaction, (bool Commit, T Value)>, CancellationToken)

Begins a transaction before executing the action. Commits if there are no exceptions, the 'Commit' value from the action is true and the optional cancellation token has not been cancelled. Otherwise rolls-back the transaction.

ExecuteTransactionConditional<T>(SqlConnection, CancellationToken, Func<SqlTransaction, (bool Commit, T Value)>)

Begins a transaction before executing the action. Commits if there are no exceptions, the 'Commit' value from the action is true and the optional cancellation token has not been cancelled. Otherwise rolls-back the transaction.

ExecuteTransaction<T>(SqlConnection, IsolationLevel, Func<SqlTransaction, T>, CancellationToken)

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

ExecuteTransaction<T>(SqlConnection, IsolationLevel, CancellationToken, Func<SqlTransaction, T>)

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

ExecuteTransaction<T>(SqlConnection, Func<SqlTransaction, 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.

ExecuteTransaction<T>(SqlConnection, Func<SqlTransaction, 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.

ExecuteTransaction<T>(SqlConnection, CancellationToken, Func<SqlTransaction, 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.