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

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

            return(OnInternal <TException>(retry));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 5
0
 private static RetryCondition OnInternal <TException>(Retry retry) where TException : Exception
 {
     return(OnInternal <TException>(retry, (handle) => true));
 }
Ejemplo n.º 6
0
        public static RetryCondition On(Func <RetryConditionHandle, bool> predicate)
        {
            var retry = new Retry();

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