Table of Contents

Class SqlServerRetryPolicy

Namespace
LinqToDB.DataProvider.SqlServer
Assembly
linq2db.dll
public class SqlServerRetryPolicy : RetryPolicyBase, IRetryPolicy
Inheritance
SqlServerRetryPolicy
Implements
Inherited Members
Extension Methods

Constructors

SqlServerRetryPolicy()

Creates a new instance of SqlServerRetryPolicy.

public SqlServerRetryPolicy()

Remarks

The default retry limit is 5, which means that the total amount of time spent before failing is 26 seconds plus the random factor.

SqlServerRetryPolicy(int)

Creates a new instance of SqlServerRetryPolicy.

public SqlServerRetryPolicy(int maxRetryCount)

Parameters

maxRetryCount int

The maximum number of retry attempts.

SqlServerRetryPolicy(int, TimeSpan, double, double, TimeSpan, ICollection<int>?)

Creates a new instance of SqlServerRetryPolicy.

public SqlServerRetryPolicy(int maxRetryCount, TimeSpan maxRetryDelay, double randomFactor, double exponentialBase, TimeSpan coefficient, ICollection<int>? errorNumbersToAdd)

Parameters

maxRetryCount int

The maximum number of retry attempts.

maxRetryDelay TimeSpan

The maximum delay in milliseconds between retries.

randomFactor double

The maximum random factor.

exponentialBase double

The base for the exponential function used to compute the delay between retries.

coefficient TimeSpan

The coefficient for the exponential function used to compute the delay between retries.

errorNumbersToAdd ICollection<int>

Additional SQL error numbers that should be considered transient.

Methods

GetNextDelay(Exception)

protected override TimeSpan? GetNextDelay(Exception lastException)

Parameters

lastException Exception

Returns

TimeSpan?

ShouldRetryOn(Exception)

protected override bool ShouldRetryOn(Exception exception)

Parameters

exception Exception

Returns

bool