kCura.Data.RowDataGateway.QueryRetryPolicy<T>
A utility for wrapping a SQL query with several retry behaviors.
Each retry behavior is executed in the order that they were applied.
Creates a QueryRetryPolicy using the default instance setting values for retry count and wait duration.
Default values are sourced from the NumberOfTriesOnDeadlock, DeadlockWaitDurationMilliseconds,
NumberOfTriesOnTimeout, and TimeoutBaseWaitDurationMilliseconds instance settings in the kCura.Data.RowDataGateway section.
public QueryRetryPolicy(Func<T> queryLogic, SqlExecutionLogger logger, int deadlockRetries, int deadlockWaitMillis, int timeoutRetries, int timeoutBaseWaitMillis, int transientRetries, int transientWaitMillis)
Creates a QueryRetryPolicy using the provided values for retry count and wait duration.
public QueryRetryPolicy(Func<T> queryLogic, SqlExecutionLogger logger, Func<int> deadlockRetries, Func<int> deadlockWaitMillis, Func<int> timeoutRetries, Func<int> timeoutBaseWaitMillis, Func<int> transientRetries, Func<int> transientWaitMillis)
Creates a QueryRetryPolicy using the provided values for retry count and wait duration.
public QueryRetryPolicy(Func<T> queryLogic, SqlExecutionLogger logger, Func<int> deadlockRetries, Func<int> deadlockWaitMillis, Func<int> timeoutRetries, Func<int> timeoutBaseWaitMillis, Func<int> transientRetries, Func<int> transientWaitMillis, Func<double> randomnessSource)
Creates a QueryRetryPolicy using the provided values for retry count and wait duration.
public QueryRetryPolicy(Func<T> queryLogic, SqlExecutionLogger logger, QueryRetryConfiguration retryConfiguration)
Creates a QueryRetryPolicy using the provided configuration for retry count and wait duration.
public QueryRetryPolicy(Func<T> queryLogic, SqlExecutionLogger logger, QueryRetryConfiguration retryConfiguration, Func<double> randomnessSource)
Creates a QueryRetryPolicy using the provided configuration for retry count and wait duration.
protected virtual Func<T> Failover(Func<T> baseLogic, Func<T> failoverLogic, Func<Exception, bool> checkToFailover)
Specifies an action to perform when any exception is thrown during query execution.
This does not catch or re-throw the exception in any way.
protected virtual Func<T> Retry(Func<T> baseLogic, QueryRetrySettings config, Func<Exception, bool> retryLogic, Func<Exception, IEnumerable<Exception>, Exception> exceptionAggregator)
Specifies that the query should be retried when it either fails to connect to the SQL server or
fails to obtain a connection from the connection pool within the allowed time.
Specifies that the query should be retried when it encounters a deadlock.
Specifies that the query should be retried when the command fails to run within the allowed time.
Specifies that the query should be retried without the "option (hash join)" query hint when
it encounters a query hint error.
Specifies a default return value when the query is forcibly canceled by the user.
Executes the SQL query with the specified retry behaviors.
Each retry behavior is executed in the order that they were applied.