Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RetryPolicy"/> class with the specified number of retry attempts and parameters defining the progressive delay between retries.
        /// </summary>
        /// <param name="errorDetectionStrategy">The <see cref="ITransientErrorDetectionStrategy"/> that is responsible for detecting transient conditions.</param>
        /// <param name="retryStrategy">The strategy to use for this retry policy.</param>
        public RetryPolicy(ITransientErrorDetectionStrategy errorDetectionStrategy, RetryStrategy retryStrategy)
        {
            Guard.ArgumentNotNull(errorDetectionStrategy, "errorDetectionStrategy");
            Guard.ArgumentNotNull(retryStrategy, "retryPolicy");

            this.ErrorDetectionStrategy = errorDetectionStrategy;

            if (errorDetectionStrategy == null)
            {
                throw new InvalidOperationException("The error detection strategy type must implement the ITransientErrorDetectionStrategy interface.");
            }

            this.RetryStrategy = retryStrategy;
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RetryPolicy{T}"/> class with the specified number of retry attempts and parameters defining the progressive delay between retries.
 /// </summary>
 /// <param name="retryStrategy">The strategy to use for this retry policy.</param>
 public RetryPolicy(RetryStrategy retryStrategy)
     : base(new T(), retryStrategy)
 {
 }