Share via


RelationalExecutionStrategyExtensions.ExecuteInTransaction Method

Definition

Overloads

ExecuteInTransaction(IExecutionStrategy, Action, Func<Boolean>, IsolationLevel)

Executes the specified operation in a transaction. Allows to check whether the transaction has been rolled back if an error occurs during commit.

ExecuteInTransaction<TResult>(IExecutionStrategy, Func<TResult>, Func<Boolean>, IsolationLevel)

Executes the specified operation in a transaction and returns the result. Allows to check whether the transaction has been rolled back if an error occurs during commit.

ExecuteInTransaction<TState,TResult>(IExecutionStrategy, TState, Func<TState,TResult>, Func<TState,Boolean>, IsolationLevel)

Executes the specified operation in a transaction and returns the result. Allows to check whether the transaction has been rolled back if an error occurs during commit.

ExecuteInTransaction<TState>(IExecutionStrategy, TState, Action<TState>, Func<TState,Boolean>, IsolationLevel)

Executes the specified operation in a transaction. Allows to check whether the transaction has been rolled back if an error occurs during commit.

ExecuteInTransaction(IExecutionStrategy, Action, Func<Boolean>, IsolationLevel)

Executes the specified operation in a transaction. Allows to check whether the transaction has been rolled back if an error occurs during commit.

public static void ExecuteInTransaction (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Action operation, Func<bool> verifySucceeded, System.Data.IsolationLevel isolationLevel);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Action * Func<bool> * System.Data.IsolationLevel -> unit
<Extension()>
Public Sub ExecuteInTransaction (strategy As IExecutionStrategy, operation As Action, verifySucceeded As Func(Of Boolean), isolationLevel As IsolationLevel)

Parameters

strategy
IExecutionStrategy

The strategy that will be used for the execution.

operation
Action

A delegate representing an executable operation.

verifySucceeded
Func<Boolean>

A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed.

isolationLevel
IsolationLevel

The isolation level to use for the transaction.

Exceptions

The operation has not succeeded after the configured number of retries.

Remarks

See Connection resiliency and database retries for more information and examples.

Applies to

ExecuteInTransaction<TResult>(IExecutionStrategy, Func<TResult>, Func<Boolean>, IsolationLevel)

Executes the specified operation in a transaction and returns the result. Allows to check whether the transaction has been rolled back if an error occurs during commit.

public static TResult ExecuteInTransaction<TResult> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Func<TResult> operation, Func<bool> verifySucceeded, System.Data.IsolationLevel isolationLevel);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Func<'Result> * Func<bool> * System.Data.IsolationLevel -> 'Result
<Extension()>
Public Function ExecuteInTransaction(Of TResult) (strategy As IExecutionStrategy, operation As Func(Of TResult), verifySucceeded As Func(Of Boolean), isolationLevel As IsolationLevel) As TResult

Type Parameters

TResult

The return type of operation.

Parameters

strategy
IExecutionStrategy

The strategy that will be used for the execution.

operation
Func<TResult>

A delegate representing an executable operation that returns the result of type TResult.

verifySucceeded
Func<Boolean>

A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed.

isolationLevel
IsolationLevel

The isolation level to use for the transaction.

Returns

TResult

The result from the operation.

Exceptions

The operation has not succeeded after the configured number of retries.

Remarks

See Connection resiliency and database retries for more information and examples.

Applies to

ExecuteInTransaction<TState,TResult>(IExecutionStrategy, TState, Func<TState,TResult>, Func<TState,Boolean>, IsolationLevel)

Executes the specified operation in a transaction and returns the result. Allows to check whether the transaction has been rolled back if an error occurs during commit.

public static TResult ExecuteInTransaction<TState,TResult> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, TState state, Func<TState,TResult> operation, Func<TState,bool> verifySucceeded, System.Data.IsolationLevel isolationLevel);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * 'State * Func<'State, 'Result> * Func<'State, bool> * System.Data.IsolationLevel -> 'Result
<Extension()>
Public Function ExecuteInTransaction(Of TState, TResult) (strategy As IExecutionStrategy, state As TState, operation As Func(Of TState, TResult), verifySucceeded As Func(Of TState, Boolean), isolationLevel As IsolationLevel) As TResult

Type Parameters

TState

The type of the state.

TResult

The return type of operation.

Parameters

strategy
IExecutionStrategy

The strategy that will be used for the execution.

state
TState

The state that will be passed to the operation.

operation
Func<TState,TResult>

A delegate representing an executable operation that returns the result of type TResult.

verifySucceeded
Func<TState,Boolean>

A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed.

isolationLevel
IsolationLevel

The isolation level to use for the transaction.

Returns

TResult

The result from the operation.

Exceptions

The operation has not succeeded after the configured number of retries.

Remarks

See Connection resiliency and database retries for more information and examples.

Applies to

ExecuteInTransaction<TState>(IExecutionStrategy, TState, Action<TState>, Func<TState,Boolean>, IsolationLevel)

Executes the specified operation in a transaction. Allows to check whether the transaction has been rolled back if an error occurs during commit.

public static void ExecuteInTransaction<TState> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, TState state, Action<TState> operation, Func<TState,bool> verifySucceeded, System.Data.IsolationLevel isolationLevel);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * 'State * Action<'State> * Func<'State, bool> * System.Data.IsolationLevel -> unit
<Extension()>
Public Sub ExecuteInTransaction(Of TState) (strategy As IExecutionStrategy, state As TState, operation As Action(Of TState), verifySucceeded As Func(Of TState, Boolean), isolationLevel As IsolationLevel)

Type Parameters

TState

The type of the state.

Parameters

strategy
IExecutionStrategy

The strategy that will be used for the execution.

state
TState

The state that will be passed to the operation.

operation
Action<TState>

A delegate representing an executable operation.

verifySucceeded
Func<TState,Boolean>

A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed.

isolationLevel
IsolationLevel

The isolation level to use for the transaction.

Exceptions

The operation has not succeeded after the configured number of retries.

Remarks

See Connection resiliency and database retries for more information and examples.

Applies to