Class RelationalExecutionStrategyExtensions
- Namespace
- Microsoft.EntityFrameworkCore.Storage
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
Extension methods for Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy that can only be used with a relational database provider.
public static class RelationalExecutionStrategyExtensions- Inheritance
- 
      
      RelationalExecutionStrategyExtensions
- Inherited Members
Methods
ExecuteInTransaction(IExecutionStrategy, Action, Func<bool>, 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 IExecutionStrategy strategy, Action operation, Func<bool> verifySucceeded, IsolationLevel isolationLevel)Parameters
- strategyIExecutionStrategy
- The strategy that will be used for the execution. 
- operationAction
- A delegate representing an executable operation. 
- verifySucceededFunc<bool>
- A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed. 
- isolationLevelIsolationLevel
- The isolation level to use for the transaction. 
Exceptions
- Microsoft.EntityFrameworkCore.Storage.RetryLimitExceededException
- The operation has not succeeded after the configured number of retries. 
ExecuteInTransactionAsync(IExecutionStrategy, Func<CancellationToken, Task>, Func<CancellationToken, Task<bool>>, IsolationLevel, CancellationToken)
Executes the specified asynchronous operation in a transaction. Allows to check whether the transaction has been rolled back if an error occurs during commit.
public static Task ExecuteInTransactionAsync(this IExecutionStrategy strategy, Func<CancellationToken, Task> operation, Func<CancellationToken, Task<bool>> verifySucceeded, IsolationLevel isolationLevel, CancellationToken cancellationToken = default)Parameters
- strategyIExecutionStrategy
- The strategy that will be used for the execution. 
- operationFunc<CancellationToken, Task>
- A function that returns a started task. 
- verifySucceededFunc<CancellationToken, Task<bool>>
- A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed. 
- isolationLevelIsolationLevel
- The isolation level to use for the transaction. 
- cancellationTokenCancellationToken
- A cancellation token used to cancel the retry operation, but not operations that are already in flight or that already completed successfully. 
Returns
- Task
- A task that will run to completion if the original task completes successfully (either the first time or after retrying transient failures). If the task fails with a non-transient error or the retry limit is reached, the returned task will become faulted and the exception must be observed. 
Exceptions
- Microsoft.EntityFrameworkCore.Storage.RetryLimitExceededException
- The operation has not succeeded after the configured number of retries. 
ExecuteInTransactionAsync(IExecutionStrategy, Func<Task>, Func<Task<bool>>, IsolationLevel)
Executes the specified asynchronous operation in a transaction. Allows to check whether the transaction has been rolled back if an error occurs during commit.
public static Task ExecuteInTransactionAsync(this IExecutionStrategy strategy, Func<Task> operation, Func<Task<bool>> verifySucceeded, IsolationLevel isolationLevel)Parameters
- strategyIExecutionStrategy
- The strategy that will be used for the execution. 
- operationFunc<Task>
- A function that returns a started task. 
- verifySucceededFunc<Task<bool>>
- A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed. 
- isolationLevelIsolationLevel
- The isolation level to use for the transaction. 
Returns
- Task
- A task that will run to completion if the original task completes successfully (either the first time or after retrying transient failures). If the task fails with a non-transient error or the retry limit is reached, the returned task will become faulted and the exception must be observed. 
Exceptions
- Microsoft.EntityFrameworkCore.Storage.RetryLimitExceededException
- The operation has not succeeded after the configured number of retries. 
ExecuteInTransactionAsync<TResult>(IExecutionStrategy, Func<CancellationToken, Task<TResult>>, Func<CancellationToken, Task<bool>>, IsolationLevel, CancellationToken)
Executes the specified asynchronous 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 Task<TResult> ExecuteInTransactionAsync<TResult>(this IExecutionStrategy strategy, Func<CancellationToken, Task<TResult>> operation, Func<CancellationToken, Task<bool>> verifySucceeded, IsolationLevel isolationLevel, CancellationToken cancellationToken = default)Parameters
- strategyIExecutionStrategy
- The strategy that will be used for the execution. 
- operationFunc<CancellationToken, Task<TResult>>
- A function that returns a started task of type - TResult.
- verifySucceededFunc<CancellationToken, Task<bool>>
- A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed. 
- isolationLevelIsolationLevel
- The isolation level to use for the transaction. 
- cancellationTokenCancellationToken
- A cancellation token used to cancel the retry operation, but not operations that are already in flight or that already completed successfully. 
Returns
- Task<TResult>
- A task that will run to completion if the original task completes successfully (either the first time or after retrying transient failures). If the task fails with a non-transient error or the retry limit is reached, the returned task will become faulted and the exception must be observed. 
Type Parameters
- TResult
- The result type of the Task<TResult> returned by - operation.
Exceptions
- Microsoft.EntityFrameworkCore.Storage.RetryLimitExceededException
- The operation has not succeeded after the configured number of retries. 
ExecuteInTransactionAsync<TState>(IExecutionStrategy, TState, Func<TState, CancellationToken, Task>, Func<TState, CancellationToken, Task<bool>>, IsolationLevel, CancellationToken)
Executes the specified asynchronous operation in a transaction. Allows to check whether the transaction has been rolled back if an error occurs during commit.
public static Task ExecuteInTransactionAsync<TState>(this IExecutionStrategy strategy, TState state, Func<TState, CancellationToken, Task> operation, Func<TState, CancellationToken, Task<bool>> verifySucceeded, IsolationLevel isolationLevel, CancellationToken cancellationToken = default)Parameters
- strategyIExecutionStrategy
- The strategy that will be used for the execution. 
- stateTState
- The state that will be passed to the operation. 
- operationFunc<TState, CancellationToken, Task>
- A function that returns a started task. 
- verifySucceededFunc<TState, CancellationToken, Task<bool>>
- A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed. 
- isolationLevelIsolationLevel
- The isolation level to use for the transaction. 
- cancellationTokenCancellationToken
- A cancellation token used to cancel the retry operation, but not operations that are already in flight or that already completed successfully. 
Returns
- Task
- A task that will run to completion if the original task completes successfully (either the first time or after retrying transient failures). If the task fails with a non-transient error or the retry limit is reached, the returned task will become faulted and the exception must be observed. 
Type Parameters
- TState
- The type of the state. 
Exceptions
- Microsoft.EntityFrameworkCore.Storage.RetryLimitExceededException
- The operation has not succeeded after the configured number of retries. 
ExecuteInTransactionAsync<TState, TResult>(IExecutionStrategy, TState, Func<TState, CancellationToken, Task<TResult>>, Func<TState, CancellationToken, Task<bool>>, IsolationLevel, CancellationToken)
Executes the specified asynchronous operation and returns the result. Allows to check whether the transaction has been rolled back if an error occurs during commit.
public static Task<TResult> ExecuteInTransactionAsync<TState, TResult>(this IExecutionStrategy strategy, TState state, Func<TState, CancellationToken, Task<TResult>> operation, Func<TState, CancellationToken, Task<bool>> verifySucceeded, IsolationLevel isolationLevel, CancellationToken cancellationToken = default)Parameters
- strategyIExecutionStrategy
- The strategy that will be used for the execution. 
- stateTState
- The state that will be passed to the operation. 
- operationFunc<TState, CancellationToken, Task<TResult>>
- A function that returns a started task of type - TResult.
- verifySucceededFunc<TState, CancellationToken, Task<bool>>
- A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed. 
- isolationLevelIsolationLevel
- The isolation level to use for the transaction. 
- cancellationTokenCancellationToken
- A cancellation token used to cancel the retry operation, but not operations that are already in flight or that already completed successfully. 
Returns
- Task<TResult>
- A task that will run to completion if the original task completes successfully (either the first time or after retrying transient failures). If the task fails with a non-transient error or the retry limit is reached, the returned task will become faulted and the exception must be observed. 
Type Parameters
- TState
- The type of the state. 
- TResult
- The result type of the Task<TResult> returned by - operation.
Exceptions
- Microsoft.EntityFrameworkCore.Storage.RetryLimitExceededException
- The operation has not succeeded after the configured number of retries. 
ExecuteInTransaction<TResult>(IExecutionStrategy, Func<TResult>, Func<bool>, 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 IExecutionStrategy strategy, Func<TResult> operation, Func<bool> verifySucceeded, IsolationLevel isolationLevel)Parameters
- strategyIExecutionStrategy
- The strategy that will be used for the execution. 
- operationFunc<TResult>
- A delegate representing an executable operation that returns the result of type - TResult.
- verifySucceededFunc<bool>
- A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed. 
- isolationLevelIsolationLevel
- The isolation level to use for the transaction. 
Returns
- TResult
- The result from the operation. 
Type Parameters
- TResult
- The return type of - operation.
Exceptions
- Microsoft.EntityFrameworkCore.Storage.RetryLimitExceededException
- The operation has not succeeded after the configured number of retries. 
ExecuteInTransaction<TState>(IExecutionStrategy, TState, Action<TState>, Func<TState, bool>, 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 IExecutionStrategy strategy, TState state, Action<TState> operation, Func<TState, bool> verifySucceeded, IsolationLevel isolationLevel)Parameters
- strategyIExecutionStrategy
- The strategy that will be used for the execution. 
- stateTState
- The state that will be passed to the operation. 
- operationAction<TState>
- A delegate representing an executable operation. 
- verifySucceededFunc<TState, bool>
- A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed. 
- isolationLevelIsolationLevel
- The isolation level to use for the transaction. 
Type Parameters
- TState
- The type of the state. 
Exceptions
- Microsoft.EntityFrameworkCore.Storage.RetryLimitExceededException
- The operation has not succeeded after the configured number of retries. 
ExecuteInTransaction<TState, TResult>(IExecutionStrategy, TState, Func<TState, TResult>, Func<TState, bool>, 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 IExecutionStrategy strategy, TState state, Func<TState, TResult> operation, Func<TState, bool> verifySucceeded, IsolationLevel isolationLevel)Parameters
- strategyIExecutionStrategy
- The strategy that will be used for the execution. 
- stateTState
- The state that will be passed to the operation. 
- operationFunc<TState, TResult>
- A delegate representing an executable operation that returns the result of type - TResult.
- verifySucceededFunc<TState, bool>
- A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed. 
- isolationLevelIsolationLevel
- The isolation level to use for the transaction. 
Returns
- TResult
- The result from the operation. 
Type Parameters
- TState
- The type of the state. 
- TResult
- The return type of - operation.
Exceptions
- Microsoft.EntityFrameworkCore.Storage.RetryLimitExceededException
- The operation has not succeeded after the configured number of retries.