SqlRetryLogicBaseProvider.Execute<TResult> Method

Definition

Executes a function and applies retry logic, if enabled. Note: Exceptions will be reported via an aggregate exception if the execution isn't successful via retry attempts.

public:
generic <typename TResult>
 abstract TResult Execute(System::Object ^ sender, Func<TResult> ^ function);
public abstract TResult Execute<TResult> (object sender, Func<TResult> function);
abstract member Execute : obj * Func<'Result> -> 'Result
Public MustOverride Function Execute(Of TResult) (sender As Object, function As Func(Of TResult)) As TResult

Type Parameters

TResult

The object that the function returns when executed.

Parameters

sender
Object

The source of the event.

function
Func<TResult>

The operation to re-execute if a transient condition occurs.

Returns

TResult

The return value of the function if it runs without exception.

Exceptions

The function parameter can't be null.

The collection of exceptions after all retry attempts have failed.

Remarks

Note

The type of exception depends on the function's internal implementation. But if the exception is due to all retry attempts failing, it will be an AggregateException that consists of all exceptions that happened during the failed attempts.

Applies to