Пример #1
0
 /// <summary>
 /// Sets the specified retry manager as the default retry manager.
 /// </summary>
 /// <param name="retryManager">The retry manager.</param>
 /// <param name="throwIfSet">true to throw an exception if the manager is already set; otherwise, false. Defaults to <see langword="true" />.</param>
 /// <exception cref="T:System.InvalidOperationException">The singleton is already set and <paramref name="throwIfSet" /> is true.</exception>
 public static void SetDefault(RetryManager retryManager, bool throwIfSet = true)
 {
     if (defaultRetryManager != null && throwIfSet && retryManager != defaultRetryManager)
     {
         throw new InvalidOperationException("Retry manager already set");
     }
     defaultRetryManager = retryManager;
 }
Пример #2
0
        public static RetryPolicy GetDefaultSqlCommandRetryPolicy(this RetryManager retryManager)
        {
            if (retryManager == null)
            {
                throw new ArgumentNullException("retryManager");
            }

            return(new RetryPolicy(new SqlDatabaseTransientErrorDetectionStrategy(), retryManager.GetDefaultSqlCommandRetryStrategy()));
        }
Пример #3
0
        public static RetryStrategy GetDefaultSqlCommandRetryStrategy(this RetryManager retryManager)
        {
            if (retryManager == null)
            {
                throw new ArgumentNullException("retryManager");
            }

            return(retryManager.GetDefaultRetryStrategy(DefaultStrategyCommandTechnologyName));
        }
Пример #4
0
        public static RetryStrategy GetDefaultSqlConnectionRetryStrategy(this RetryManager retryManager)
        {
            if (retryManager == null)
            {
                throw new ArgumentNullException("retryManager");
            }

            try
            {
                return(retryManager.GetDefaultRetryStrategy(DefaultStrategyConnectionTechnologyName));
            }
            catch (ArgumentOutOfRangeException)
            {
                return(retryManager.GetDefaultRetryStrategy(DefaultStrategyCommandTechnologyName));
            }
        }