コード例 #1
0
 public void Setup()
 {
     connectionString = TestSqlSupport.SqlDatabaseConnectionString;
     RetryPolicyFactory.CreateDefault();
 }
コード例 #2
0
 public RetryPolicy GetDefaultSqlConnectionRetryPolicy()
 {
     return(RetryPolicyFactory.GetDefaultSqlConnectionRetryPolicy());
 }
コード例 #3
0
 public RetryPolicy GetDefaultSqlCommandRetryPolicy()
 {
     return(RetryPolicyFactory.GetDefaultSqlCommandRetryPolicy());
 }
コード例 #4
0
 /// <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()));
 }
コード例 #5
0
 /// <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()));
 }
コード例 #6
0
 public void SetRetryPolicy(RetryPolicyFactory factory)
 {
     _policyFactory = factory;
 }
コード例 #7
0
        /// <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();
 }
コード例 #9
0
 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);
 }
コード例 #12
0
 public void Initialize()
 {
     RetryPolicyFactory.SetRetryManager(RetryConfiguration.GetRetryManager(getCustomRetryStrategy: section =>
                                                                           section.Get <TestRetryStrategyOptions>().ToTestRetryStrategy(section.Key)), false);
 }
コード例 #13
0
 public void ExceptionIsThrownWhenRetryStrategyIsNotDefinedInConfiguration()
 {
     RetryPolicyFactory.GetRetryPolicy <MockErrorDetectionStrategy>(retryStrategyName: "someinstancewhichdoesnotexist");
 }
コード例 #14
0
        /// <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)));
        }
コード例 #15
0
 public void Cleanup()
 {
     RetryPolicyFactory.SetRetryManager(null, false);
 }
コード例 #16
0
 internal IRetryPolicy GetRetryPolicy()
 {
     return(RetryPolicyFactory.CreateExponentialRetryPolicy(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(100), 3, 0.2));
 }
コード例 #17
0
 /// <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)));
 }
コード例 #18
0
 /// <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()));
 }
コード例 #19
0
 public void Setup()
 {
     RetryPolicyFactory.CreateDefault();
 }
コード例 #20
0
 /// <summary>
 /// Initializes a new instance of the ClientBase class.
 /// </summary>
 protected ClientBase() : this(RetryDefaultConstants.DefaultOperationTimeout, RetryPolicyFactory.CreateExponentialRetryPolicy())
 {
 }