protected override AdoNetConnection GetAdoNetConnection(string conn_string) { var connection_retry_policy = Policy .Handle <Exception>(ex => error_detection_strategy.is_transient(ex)) .WaitAndRetry(new[] { TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5) }, log_command_retrying ); // Command retry policy is only used when ReliableSqlConnection.ExecuteCommand helper methods are explicitly invoked. // This is not our case, as those method are not used. var command_retry_policy = Policy.Handle <Exception>().Retry(0); var connection = new ReliableSqlConnection(conn_string, connection_retry_policy, command_retry_policy); if (!string.IsNullOrEmpty(access_token)) { connection.AccessToken = access_token; } connection_specific_setup(connection); return(new AdoNetConnection(connection)); }
protected override AdoNetConnection GetAdoNetConnection(string conn_string) { var connection_retry_policy = new RetryPolicy <TransientErrorDetectionStrategy>( 5, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5)); connection_retry_policy.Retrying += (sender, args) => log_connection_retrying(args); // Command retry policy is only used when ReliableSqlConnection.ExecuteCommand helper methods are explicitly invoked. // This is not our case, as those method are not used. var command_retry_policy = RetryPolicy.NoRetry; var connection = new ReliableSqlConnection(conn_string, connection_retry_policy, command_retry_policy); connection_specific_setup(connection); return(new AdoNetConnection(connection)); }