Share via


ExecutionStrategyExtensions.Execute Method

Definition

Overloads

Execute(IExecutionStrategy, Action)

Executes the specified operation.

Execute<TResult>(IExecutionStrategy, Func<TResult>)

Executes the specified operation and returns the result.

Execute<TState,TResult>(IExecutionStrategy, Func<TState,TResult>, TState)

Executes the specified operation and returns the result.

Execute<TState,TResult>(IExecutionStrategy, TState, Func<TState,TResult>)

Executes the specified operation and returns the result.

Execute<TState,TResult>(IExecutionStrategy, Func<TState,TResult>, Func<TState,ExecutionResult<TResult>>, TState)
Obsolete.

Executes the specified operation and returns the result.

Execute<TState,TResult>(IExecutionStrategy, TState, Func<TState,TResult>, Func<TState,ExecutionResult<TResult>>)

Executes the specified operation and returns the result.

Execute<TState>(IExecutionStrategy, Action<TState>, TState)

Executes the specified operation.

Execute<TState>(IExecutionStrategy, TState, Action<TState>)

Executes the specified operation.

Execute(IExecutionStrategy, Action)

Executes the specified operation.

public static void Execute (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Action operation);
static member Execute : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Action -> unit
<Extension()>
Public Sub Execute (strategy As IExecutionStrategy, operation As Action)

Parameters

strategy
IExecutionStrategy

The strategy that will be used for the execution.

operation
Action

A delegate representing an executable operation that doesn't return any results.

Remarks

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

Applies to

Execute<TResult>(IExecutionStrategy, Func<TResult>)

Executes the specified operation and returns the result.

public static TResult Execute<TResult> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Func<TResult> operation);
static member Execute : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Func<'Result> -> 'Result
<Extension()>
Public Function Execute(Of TResult) (strategy As IExecutionStrategy, operation As Func(Of TResult)) 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.

Returns

TResult

The result from the operation.

Remarks

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

Applies to

Execute<TState,TResult>(IExecutionStrategy, Func<TState,TResult>, TState)

Executes the specified operation and returns the result.

public static TResult Execute<TState,TResult> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Func<TState,TResult> operation, TState state);
static member Execute : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Func<'State, 'Result> * 'State -> 'Result
<Extension()>
Public Function Execute(Of TState, TResult) (strategy As IExecutionStrategy, operation As Func(Of TState, TResult), state As TState) 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.

state
TState

The state that will be passed to the operation.

Returns

TResult

The result from the operation.

Applies to

Execute<TState,TResult>(IExecutionStrategy, TState, Func<TState,TResult>)

Executes the specified operation and returns the result.

public static TResult Execute<TState,TResult> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, TState state, Func<TState,TResult> operation);
static member Execute : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * 'State * Func<'State, 'Result> -> 'Result
<Extension()>
Public Function Execute(Of TState, TResult) (strategy As IExecutionStrategy, state As TState, operation As Func(Of TState, TResult)) 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.

Returns

TResult

The result from the operation.

Remarks

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

Applies to

Execute<TState,TResult>(IExecutionStrategy, Func<TState,TResult>, Func<TState,ExecutionResult<TResult>>, TState)

Caution

Use overload that takes the state first

Executes the specified operation and returns the result.

public static TResult Execute<TState,TResult> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Func<TState,TResult> operation, Func<TState,Microsoft.EntityFrameworkCore.Storage.ExecutionResult<TResult>> verifySucceeded, TState state);
[System.Obsolete("Use overload that takes the state first")]
public static TResult Execute<TState,TResult> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Func<TState,TResult> operation, Func<TState,Microsoft.EntityFrameworkCore.Storage.ExecutionResult<TResult>> verifySucceeded, TState state);
static member Execute : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Func<'State, 'Result> * Func<'State, Microsoft.EntityFrameworkCore.Storage.ExecutionResult<'Result>> * 'State -> 'Result
[<System.Obsolete("Use overload that takes the state first")>]
static member Execute : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Func<'State, 'Result> * Func<'State, Microsoft.EntityFrameworkCore.Storage.ExecutionResult<'Result>> * 'State -> 'Result
<Extension()>
Public Function Execute(Of TState, TResult) (strategy As IExecutionStrategy, 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

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.

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

TResult

The result from the operation.

Attributes

Exceptions

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

Applies to

Execute<TState,TResult>(IExecutionStrategy, TState, Func<TState,TResult>, Func<TState,ExecutionResult<TResult>>)

Executes the specified operation and returns the result.

public static TResult Execute<TState,TResult> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, TState state, Func<TState,TResult> operation, Func<TState,Microsoft.EntityFrameworkCore.Storage.ExecutionResult<TResult>> verifySucceeded);
public static TResult Execute<TState,TResult> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, TState state, Func<TState,TResult> operation, Func<TState,Microsoft.EntityFrameworkCore.Storage.ExecutionResult<TResult>>? verifySucceeded);
static member Execute : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * 'State * Func<'State, 'Result> * Func<'State, Microsoft.EntityFrameworkCore.Storage.ExecutionResult<'Result>> -> 'Result
<Extension()>
Public Function Execute(Of TState, TResult) (strategy As IExecutionStrategy, state As TState, operation As Func(Of TState, TResult), verifySucceeded As Func(Of TState, ExecutionResult(Of TResult))) 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,ExecutionResult<TResult>>

A delegate that tests whether the operation succeeded even though an exception was thrown.

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

Execute<TState>(IExecutionStrategy, Action<TState>, TState)

Executes the specified operation.

public static void Execute<TState> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Action<TState> operation, TState state);
static member Execute : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Action<'State> * 'State -> unit
<Extension()>
Public Sub Execute(Of TState) (strategy As IExecutionStrategy, operation As Action(Of TState), state As TState)

Type Parameters

TState

The type of the state.

Parameters

strategy
IExecutionStrategy

The strategy that will be used for the execution.

operation
Action<TState>

A delegate representing an executable operation that doesn't return any results.

state
TState

The state that will be passed to the operation.

Applies to

Execute<TState>(IExecutionStrategy, TState, Action<TState>)

Executes the specified operation.

public static void Execute<TState> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, TState state, Action<TState> operation);
static member Execute : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * 'State * Action<'State> -> unit
<Extension()>
Public Sub Execute(Of TState) (strategy As IExecutionStrategy, state As TState, operation As Action(Of TState))

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 that doesn't return any results.

Remarks

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

Applies to