Exemple #1
0
        public static RetryPolicy GetDefaultAzureCachingRetryPolicy(this RetryManager retryManager)
        {
            Argument.NotNull(retryManager, nameof(retryManager));

            return(new RetryPolicy(new CacheTransientErrorDetectionStrategy(), retryManager.GetDefaultCachingRetryStrategy()));
        }
        /// <summary>
        /// Returns the default retry policy dedicated to handling transient conditions with SQL connections.
        /// </summary>
        /// <returns>The retry policy for SQL connections with the corresponding default strategy (or the default strategy, if no retry strategy for SQL connections was found).</returns>
        public static RetryPolicy GetDefaultSqlConnectionRetryPolicy(this RetryManager retryManager)
        {
            Argument.NotNull(retryManager, nameof(retryManager));

            return(new RetryPolicy(new SqlDatabaseTransientErrorDetectionStrategy(), retryManager.GetDefaultSqlConnectionRetryStrategy()));
        }
Exemple #3
0
        public static RetryStrategy GetDefaultAzureCachingRetryStrategy(this RetryManager retryManager)
        {
            Argument.NotNull(retryManager, nameof(retryManager));

            return(retryManager.GetDefaultRetryStrategy(DefaultStrategyTechnologyName));
        }
        /// <summary>
        /// Returns the default retry strategy for SQL commands.
        /// </summary>
        /// <returns>The default retry strategy for SQL commands (or the default strategy, if no default could be found).</returns>
        public static RetryStrategy GetDefaultSqlCommandRetryStrategy(this RetryManager retryManager)
        {
            Argument.NotNull(retryManager, nameof(retryManager));

            return(retryManager.GetDefaultRetryStrategy(DefaultStrategyCommandTechnologyName));
        }
        public static void OpenWithRetry(this SqlConnection connection, RetryPolicy?retryPolicy)
        {
            Argument.NotNull(connection, nameof(connection));

            (retryPolicy ?? RetryPolicy.NoRetry).ExecuteAction(connection.Open);
        }
        /// <summary>
        /// Converts <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ExponentialBackoffOptions"/> instance to <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ExponentialBackoff"/> retry strategy.
        /// </summary>
        /// <param name="options">The <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ExponentialBackoffOptions"/> instance to convert.</param>
        /// <param name="name">The name of the retry strategy.</param>
        /// <returns>The converted <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ExponentialBackoff"/> retry strategy.</returns>
        public static ExponentialBackoff ToExponentialBackoff(this ExponentialBackoffOptions options, string name)
        {
            Argument.NotNull(options, nameof(options));

            return(new ExponentialBackoff(name, options.RetryCount, options.MinBackOff, options.MaxBackOff, options.DeltaBackOff, options.FastFirstRetry));
        }
        /// <summary>
        /// Converts <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.IncrementalOptions"/> instance to <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.Incremental"/> retry strategy.
        /// </summary>
        /// <param name="options">The <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.IncrementalOptions"/> instance to convert.</param>
        /// <param name="name">The name of the retry strategy.</param>
        /// <returns>The converted <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.Incremental"/> retry strategy.</returns>
        public static Incremental ToIncremental(this IncrementalOptions options, string name)
        {
            Argument.NotNull(options, nameof(options));

            return(new Incremental(name, options.RetryCount, options.InitialInterval, options.Increment, options.FastFirstRetry));
        }
        /// <summary>
        /// Converts <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.FixedIntervalOptions"/> instance to <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.FixedInterval"/> retry strategy.
        /// </summary>
        /// <param name="options">The <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.FixedIntervalOptions"/> instance to convert.</param>
        /// <param name="name">The name of the retry strategy.</param>
        /// <returns>The converted <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.FixedInterval"/> retry strategy.</returns>
        public static FixedInterval ToFixedInterval(this FixedIntervalOptions options, string name)
        {
            Argument.NotNull(options, nameof(options));

            return(new FixedInterval(name, options.RetryCount, options.RetryInterval, options.FastFirstRetry));
        }