ExecutionStrategy.Execute 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
Execute<TState,TResult>(Func<TState,TResult>, Func<TState,ExecutionResult<TResult>>, TState) |
Executes the specified operation and returns the result. |
Execute<TState,TResult>(TState, Func<DbContext,TState,TResult>, Func<DbContext,TState,ExecutionResult<TResult>>) |
Executes the specified operation and returns the result. |
Execute<TState,TResult>(Func<TState,TResult>, Func<TState,ExecutionResult<TResult>>, TState)
Executes the specified operation and returns the result.
public virtual TResult Execute<TState,TResult> (Func<TState,TResult> operation, Func<TState,Microsoft.EntityFrameworkCore.Storage.ExecutionResult<TResult>> verifySucceeded, TState state);
abstract member Execute : Func<'State, 'Result> * Func<'State, Microsoft.EntityFrameworkCore.Storage.ExecutionResult<'Result>> * 'State -> 'Result
override this.Execute : Func<'State, 'Result> * Func<'State, Microsoft.EntityFrameworkCore.Storage.ExecutionResult<'Result>> * 'State -> 'Result
Public Overridable Function Execute(Of TState, TResult) (operation As Func(Of TState, TResult), verifySucceeded As Func(Of TState, ExecutionResult(Of TResult)), state As TState) As TResult
Type Parameters
- TState
The type of the state.
- TResult
The return type of operation
.
Parameters
- operation
- Func<TState,TResult>
A delegate representing an executable operation that returns the result of type TResult
.
- verifySucceeded
- Func<TState,ExecutionResult<TResult>>
A delegate that tests whether the operation succeeded even though an exception was thrown.
- state
- TState
The state that will be passed to the operation.
Returns
The result from the operation.
Implements
Exceptions
Thrown if the operation has not succeeded after the configured number of retries.
Applies to
Execute<TState,TResult>(TState, Func<DbContext,TState,TResult>, Func<DbContext,TState,ExecutionResult<TResult>>)
Executes the specified operation and returns the result.
public virtual TResult Execute<TState,TResult> (TState state, Func<Microsoft.EntityFrameworkCore.DbContext,TState,TResult> operation, Func<Microsoft.EntityFrameworkCore.DbContext,TState,Microsoft.EntityFrameworkCore.Storage.ExecutionResult<TResult>> verifySucceeded);
public virtual TResult Execute<TState,TResult> (TState state, Func<Microsoft.EntityFrameworkCore.DbContext,TState,TResult> operation, Func<Microsoft.EntityFrameworkCore.DbContext,TState,Microsoft.EntityFrameworkCore.Storage.ExecutionResult<TResult>>? verifySucceeded);
abstract member Execute : 'State * Func<Microsoft.EntityFrameworkCore.DbContext, 'State, 'Result> * Func<Microsoft.EntityFrameworkCore.DbContext, 'State, Microsoft.EntityFrameworkCore.Storage.ExecutionResult<'Result>> -> 'Result
override this.Execute : 'State * Func<Microsoft.EntityFrameworkCore.DbContext, 'State, 'Result> * Func<Microsoft.EntityFrameworkCore.DbContext, 'State, Microsoft.EntityFrameworkCore.Storage.ExecutionResult<'Result>> -> 'Result
Public Overridable Function Execute(Of TState, TResult) (state As TState, operation As Func(Of DbContext, TState, TResult), verifySucceeded As Func(Of DbContext, TState, ExecutionResult(Of TResult))) As TResult
Type Parameters
- TState
The type of the state.
- TResult
The return type of operation
.
Parameters
- state
- TState
The state that will be passed to the operation.
A delegate representing an executable operation that returns the result of type TResult
.
- verifySucceeded
- Func<DbContext,TState,ExecutionResult<TResult>>
A delegate that tests whether the operation succeeded even though an exception was thrown.
Returns
The result from the operation.
Implements
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