public void Setup() { connectionString = TestSqlSupport.SqlDatabaseConnectionString; RetryPolicyFactory.CreateDefault(); }
public RetryPolicy GetDefaultSqlConnectionRetryPolicy() { return(RetryPolicyFactory.GetDefaultSqlConnectionRetryPolicy()); }
public RetryPolicy GetDefaultSqlCommandRetryPolicy() { return(RetryPolicyFactory.GetDefaultSqlCommandRetryPolicy()); }
/// <summary> /// Executes a Transact-SQL statement against the connection and returns the number of rows affected. Uses the default retry policy when executing the command. /// </summary> /// <param name="command">The command object which is required as per extension method declaration.</param> /// <returns>The number of rows affected.</returns> public static int ExecuteNonQueryWithRetry(this SqlCommand command) { return(ExecuteNonQueryWithRetry(command, RetryPolicyFactory.GetDefaultSqlCommandRetryPolicy())); }
/// <summary> /// Sends the specified command to the connection and builds a SqlDataReader object containing the results. /// Uses the default retry policy when executing the command. /// </summary> /// <param name="command">The command object which is required as per extension method declaration.</param> /// <returns>A System.Data.SqlClient.SqlDataReader object.</returns> public static SqlDataReader ExecuteReaderWithRetry(this SqlCommand command) { return(ExecuteReaderWithRetry(command, RetryPolicyFactory.GetDefaultSqlCommandRetryPolicy())); }
public void SetRetryPolicy(RetryPolicyFactory factory) { _policyFactory = factory; }
/// <summary> /// Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored. /// Uses the default retry policy when executing the command. /// </summary> /// <param name="command">The command object that is required as per extension method declaration.</param> /// <returns> The first column of the first row in the result set, or a null reference if the result set is empty. Returns a maximum of 2033 characters.</returns> public static object ExecuteScalarWithRetry(this IDbCommand command) { var connectionString = command.Connection.ConnectionString ?? string.Empty; return(ExecuteScalarWithRetry(command, RetryPolicyFactory.GetDefaultSqlCommandRetryPolicyByConnectionString(connectionString))); }
protected override void Act() { this.retryPolicy = RetryPolicyFactory.GetDefaultSqlConnectionRetryPolicy(); }
public void Initialize() { this.connectionString = TestSqlSupport.SqlDatabaseConnectionString; RetryPolicyFactory.CreateDefault(); }
protected override void Arrange() { RetryPolicyFactory.SetRetryManager(this.GetSettings().ToRetryManager(), false); }
protected override void Teardown() { RetryPolicyFactory.SetRetryManager(null, false); }
public void Initialize() { RetryPolicyFactory.SetRetryManager(RetryConfiguration.GetRetryManager(getCustomRetryStrategy: section => section.Get <TestRetryStrategyOptions>().ToTestRetryStrategy(section.Key)), false); }
public void ExceptionIsThrownWhenRetryStrategyIsNotDefinedInConfiguration() { RetryPolicyFactory.GetRetryPolicy <MockErrorDetectionStrategy>(retryStrategyName: "someinstancewhichdoesnotexist"); }
/// <summary> /// Sends the specified command to the connection and builds a SqlDataReader object containing the results. /// Uses the specified retry policy when executing the command. /// </summary> /// <param name="command">The command object that is required as per extension method declaration.</param> /// <param name="retryPolicy">The retry policy defining whether to retry a command if a connection fails while executing the command.</param> /// <returns>A System.Data.IDataReader object.</returns> public static IDataReader ExecuteReaderWithRetry(this IDbCommand command, RetryPolicy retryPolicy) { var connectionString = command.Connection.ConnectionString ?? string.Empty; return(ExecuteReaderWithRetry(command, retryPolicy, RetryPolicyFactory.GetDefaultSqlConnectionRetryPolicyByConnectionString(connectionString))); }
public void Cleanup() { RetryPolicyFactory.SetRetryManager(null, false); }
internal IRetryPolicy GetRetryPolicy() { return(RetryPolicyFactory.CreateExponentialRetryPolicy(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(100), 3, 0.2)); }
/// <summary> /// Inserts the specified azure rangeShard. /// </summary> /// <param name="azureRangeShard">The azure rangeShard.</param> public void Insert(AzureRangeShard azureRangeShard) { RetryPolicyFactory.GetDefaultAzureStorageRetryPolicy() .ExecuteAction(() => _table.Execute(TableOperation.Insert(azureRangeShard))); }
/// <summary> /// Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored. /// Uses the default retry policy when executing the command. /// </summary> /// <param name="command">The command object which is required as per extension method declaration.</param> /// <returns> The first column of the first row in the result set, or a null reference if the result set is empty. Returns a maximum of 2033 characters.</returns> public static object ExecuteScalarWithRetry(this SqlCommand command) { return(ExecuteScalarWithRetry(command, RetryPolicyFactory.GetDefaultSqlCommandRetryPolicy())); }
public void Setup() { RetryPolicyFactory.CreateDefault(); }
/// <summary> /// Initializes a new instance of the ClientBase class. /// </summary> protected ClientBase() : this(RetryDefaultConstants.DefaultOperationTimeout, RetryPolicyFactory.CreateExponentialRetryPolicy()) { }