ExecutionStrategyExtensions.ExecuteInTransaction Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ExecuteInTransaction(IExecutionStrategy, Action, Func<Boolean>) |
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>) |
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>, Func<DbContext,IDbContextTransaction>) |
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, Func<TState,TResult>, Func<TState,Boolean>, TState, DbContext) |
Executes the specified operation in a transaction and returns the result after commiting it. |
ExecuteInTransaction<TState,TResult>(IExecutionStrategy, TState, Func<TState,TResult>, Func<TState,Boolean>) |
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>) |
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>)
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);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Action * Func<bool> -> unit
<Extension()>
Public Sub ExecuteInTransaction (strategy As IExecutionStrategy, operation As Action, verifySucceeded As Func(Of Boolean))
Parameters
- strategy
- IExecutionStrategy
The strategy that will be used for the execution.
- operation
- Action
A delegate representing an executable operation.
A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed.
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>)
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);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Func<'Result> * Func<bool> -> 'Result
<Extension()>
Public Function ExecuteInTransaction(Of TResult) (strategy As IExecutionStrategy, operation As Func(Of TResult), verifySucceeded As Func(Of Boolean)) 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
.
A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed.
Returns
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>, Func<DbContext,IDbContextTransaction>)
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> (Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, TState state, Func<TState,TResult> operation, Func<TState,bool> verifySucceeded, Func<Microsoft.EntityFrameworkCore.DbContext,Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction> beginTransaction);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * 'State * Func<'State, 'Result> * Func<'State, bool> * Func<Microsoft.EntityFrameworkCore.DbContext, Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction> -> 'Result
Public Function ExecuteInTransaction(Of TState, TResult) (strategy As IExecutionStrategy, state As TState, operation As Func(Of TState, TResult), verifySucceeded As Func(Of TState, Boolean), beginTransaction As Func(Of DbContext, IDbContextTransaction)) 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
.
A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed.
- beginTransaction
- Func<DbContext,IDbContextTransaction>
A delegate that begins a transaction using the given context.
Returns
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, Func<TState,TResult>, Func<TState,Boolean>, TState, DbContext)
Executes the specified operation in a transaction and returns the result after commiting it.
public static TResult ExecuteInTransaction<TState,TResult> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Func<TState,TResult> operation, Func<TState,bool> verifySucceeded, TState state, Microsoft.EntityFrameworkCore.DbContext context);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Func<'State, 'Result> * Func<'State, bool> * 'State * Microsoft.EntityFrameworkCore.DbContext -> 'Result
<Extension()>
Public Function ExecuteInTransaction(Of TState, TResult) (strategy As IExecutionStrategy, operation As Func(Of TState, TResult), verifySucceeded As Func(Of TState, Boolean), state As TState, context As DbContext) 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.
- operation
- Func<TState,TResult>
A delegate representing an executable operation that returns the result of type TResult
.
A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed.
- state
- TState
The state that will be passed to the operation.
- context
- DbContext
The context that will be used to start the transaction.
Returns
The result from the operation.
Exceptions
Thrown if the operation has not succeeded after the configured number of retries.
Applies to
ExecuteInTransaction<TState,TResult>(IExecutionStrategy, TState, Func<TState,TResult>, Func<TState,Boolean>)
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);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * 'State * Func<'State, 'Result> * Func<'State, bool> -> '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)) 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
.
A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed.
Returns
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>)
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);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * 'State * Action<'State> * Func<'State, bool> -> unit
<Extension()>
Public Sub ExecuteInTransaction(Of TState) (strategy As IExecutionStrategy, state As TState, operation As Action(Of TState), verifySucceeded As Func(Of TState, Boolean))
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.
A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed.
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
Entity Framework