/// <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; }
public static RetryPolicy GetDefaultSqlCommandRetryPolicy(this RetryManager retryManager) { if (retryManager == null) { throw new ArgumentNullException("retryManager"); } return(new RetryPolicy(new SqlDatabaseTransientErrorDetectionStrategy(), retryManager.GetDefaultSqlCommandRetryStrategy())); }
public static RetryStrategy GetDefaultSqlCommandRetryStrategy(this RetryManager retryManager) { if (retryManager == null) { throw new ArgumentNullException("retryManager"); } return(retryManager.GetDefaultRetryStrategy(DefaultStrategyCommandTechnologyName)); }
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)); } }