IExecutionStrategy IExecutionStrategy Interface

Definition

A strategy that is used to execute a command or query against the database, possibly with logic to retry when a failure occurs.

public interface IExecutionStrategy
Public Interface IExecutionStrategy

Properties

RetriesOnFailure RetriesOnFailure

Indicates whether this IExecutionStrategy might retry the execution after a failure.

bool RetriesOnFailure { get; }
ReadOnly Property RetriesOnFailure As Boolean
Value
System.Boolean System.Boolean

Methods

Execute(Func, TState) Execute(Of TState, TResult)(Func(Of TState, TResult), TState)

Executes the specified operation and returns the result.

TResult Execute<TState, TResult>(Func<TState, TResult> operation, TState state)
Function Execute(Of TState, TResult)(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
operation
System.Func<TState, TResult> System.Func(Of TState, TResult)

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

state
TState TState

The state that will be passed to the operation.

Returns
TResult TResult

The result from the operation.

ExecuteAsync(Func>, TState, CancellationToken) ExecuteAsync(Of TState, TResult)(Func(Of TState, CancellationToken, Task(Of TResult)), TState, CancellationToken)

Executes the specified asynchronous operation and returns the result.

Task<TResult> ExecuteAsync<TState, TResult>(Func<TState, CancellationToken, Task<TResult>> operation, TState state, CancellationToken cancellationToken)
Function ExecuteAsync(Of TState, TResult)(operation As Func(Of TState, CancellationToken, Task(Of TResult)), state As TState, cancellationToken As CancellationToken) As Task(Of TResult)
Type Parameters
TState

The type of the state.

TResult

The result type of the System.Threading.Tasks.Task<TResult> returned by operation.

Parameters
operation
System.Func<TState, System.Threading.CancellationToken, System.Threading.Tasks.Task<TResult>> System.Func(Of TState, System.Threading.CancellationToken, System.Threading.Tasks.Task(Of TResult))

A function that returns a started task of type TResult.

state
TState TState

The state that will be passed to the operation.

cancellationToken
System.Threading.CancellationToken System.Threading.CancellationToken

A cancellation token used to cancel the retry operation, but not operations that are already in flight or that already completed successfully.

Returns
System.Threading.Tasks.Task<TResult> System.Threading.Tasks.Task(Of 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.