<PackageReference Include="Microsoft.Data.SqlClient" Version="7.0.2" />

Microsoft.Data.SqlClient.SqlRetryLogicBaseProvider

public abstract class SqlRetryLogicBaseProvider
Applies retry logic on an operation through the Execute<T> or ExecuteAsync<T> function.

Occurs before applying the calculated delay time and executing the function on a next attempt.

public SqlRetryLogicBase RetryLogic { get; protected set; }

Defines the retry logic used to decide when to retry based on the encountered exception.

public abstract TResult Execute<TResult>(object sender, Func<TResult> function)

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 abstract Task<TResult> ExecuteAsync<TResult>(object sender, Func<Task<TResult>> function, CancellationToken cancellationToken = default)

Executes a function and applies retry logic, if enabled. The cancellation token can be used to request that the operation be abandoned before the execution attempts are exceeded. **Note:** Exceptions will be reported via the returned Task object, which will contain an aggregate exception if execution fails for all retry attempts.

public abstract Task ExecuteAsync(object sender, Func<Task> function, CancellationToken cancellationToken = default)

Executes a function and applies retry logic, if enabled. The cancellation token can be used to request that the operation be abandoned before the execution attempts are exceeded. ** Note:** Exceptions will be reported via the returned Task object, which will contain an aggregate exception if execution fails for all retry attempts.