Example #1
0
        public static RetryCondition On <TException>(Func <RetryConditionHandle, bool> predicate) where TException : Exception
        {
            var retry = new Retry();

            return(OnInternal <TException>(retry, predicate));
        }
Example #2
0
 public RetryCondition(Retry retry, Func <RetryConditionHandle, bool> predicate)
 {
     Retry = retry;
     Retry.Conditions.Add(this);
     FilterCondition = predicate;
 }
Example #3
0
        public static RetryCondition On <TException>() where TException : Exception
        {
            var retry = new Retry();

            return(OnInternal <TException>(retry));
        }
Example #4
0
        private static RetryCondition OnInternal <TException>(Retry retry, Func <RetryConditionHandle, bool> predicate) where TException : Exception
        {
            Func <RetryConditionHandle, bool> typeCheckingPredicate = (handle) => handle.Context.DidExceptionOnLastRun && handle.Context.LastException is TException && predicate(handle);

            return(new RetryCondition(retry, typeCheckingPredicate));
        }
Example #5
0
 private static RetryCondition OnInternal <TException>(Retry retry) where TException : Exception
 {
     return(OnInternal <TException>(retry, (handle) => true));
 }
Example #6
0
        public static RetryCondition On(Func <RetryConditionHandle, bool> predicate)
        {
            var retry = new Retry();

            return(new RetryCondition(retry, predicate));
        }
Example #7
0
 public RetryContext(Retry retry)
 {
     Retry            = retry;
     ConditionHandles = retry.Conditions.Select(condition => new RetryConditionHandle(this, condition)).ToList();
 }