コード例 #1
0
ファイル: RetryManager.cs プロジェクト: fagan2888/Nevermore
 /// <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));
            }
        }