Share via


IDbExecutionStrategy.ExecuteAsync Method

Definition

Overloads

ExecuteAsync(Func<Task>, CancellationToken)

Executes the specified asynchronous operation.

ExecuteAsync<TResult>(Func<Task<TResult>>, CancellationToken)

Executes the specified asynchronous operation and returns the result.

ExecuteAsync(Func<Task>, CancellationToken)

Executes the specified asynchronous operation.

public System.Threading.Tasks.Task ExecuteAsync (Func<System.Threading.Tasks.Task> operation, System.Threading.CancellationToken cancellationToken);
abstract member ExecuteAsync : Func<System.Threading.Tasks.Task> * System.Threading.CancellationToken -> System.Threading.Tasks.Task

Parameters

operation
Func<Task>

A function that returns a started task.

cancellationToken
CancellationToken

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

Returns

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.

Applies to

ExecuteAsync<TResult>(Func<Task<TResult>>, CancellationToken)

Executes the specified asynchronous operation and returns the result.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public System.Threading.Tasks.Task<TResult> ExecuteAsync<TResult> (Func<System.Threading.Tasks.Task<TResult>> operation, System.Threading.CancellationToken cancellationToken);
abstract member ExecuteAsync : Func<System.Threading.Tasks.Task<'Result>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>

Type Parameters

TResult

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

Parameters

operation
Func<Task<TResult>>

A function that returns a started task of type TResult.

cancellationToken
CancellationToken

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.

Attributes

Applies to