IExecutionStrategy IExecutionStrategy Interface

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

Syntax

Declaration

public interface IExecutionStrategyPublic Interface IExecutionStrategy

Properties summary

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

Methods summary

Executes the specified operation and returns the result.

Executes the specified asynchronous operation and returns the result.

Properties

  • RetriesOnFailure
    RetriesOnFailure

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

    bool RetriesOnFailure { get; }ReadOnly Property RetriesOnFailure As Boolean

    Property Value

    • System.Boolean
      System.Boolean

Methods

  • Execute<TState, TResult>(Func<TState, TResult>, 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

    Parameters

    • operation
      System.Func<T, TResult><TState, TResult>
      System.Func<T, TResult>(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<TState, TResult>(Func<TState, CancellationToken, Task<TResult>>, 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)

    Parameters

    • operation
      System.Func<T1, T2, TResult><TState, System.Threading.CancellationToken, System.Threading.Tasks.Task<TResult><TResult>>
      System.Func<T1, T2, TResult>(Of TState, System.Threading.CancellationToken, System.Threading.Tasks.Task<TResult>(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><TResult>
      System.Threading.Tasks.Task<TResult>(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.

Details

Assembly

Microsoft.EntityFrameworkCore.dll