Пример #1
0
 public void AllFeatures()
 {
     // All retry features in one method:
     Retry.Execute(() => DummyMethods.DoWork("Hello world"), TimeSpan.FromMilliseconds(100), 2,
                   DummyMethods.ExecuteOnEveryException, DummyMethods.ExecuteWhenMaxRetriesReachedBeforeExceptionIsThrown,
                   typeof(ArgumentException), typeof(DbException));
 }
Пример #2
0
 public void ExecuteMethodBeforeFinalExceptionIsThrown()
 {
     // Execute the DoWork and only Execute a method before the final AggregateException is thrown
     Retry.Execute(() => DummyMethods.DoWork("Hello world"), TimeSpan.FromMilliseconds(100), 2,
                   executeBeforeFinalException: DummyMethods.ExecuteWhenMaxRetriesReachedBeforeExceptionIsThrown);
 }
Пример #3
0
 public void RetryOnlySpecificExceptions()
 {
     // Execute the DoWork and only retry with an exception that is of (base)type DbException
     Retry.Execute(() => DummyMethods.DoWork("Hello world"), TimeSpan.FromMilliseconds(100), 2,
                   exceptionTypesToHandle: new[] { typeof(ArgumentException), typeof(ArgumentOutOfRangeException) });
 }
Пример #4
0
 public void ExecuteMethodOnEachException()
 {
     // Execute the DoWork and only Execute a method after each exception is thrown.
     Retry.Execute(() => DummyMethods.DoWork("Hello world"), TimeSpan.FromMilliseconds(100), 2,
                   executeOnEveryException: DummyMethods.ExecuteOnEveryException);
 }
Пример #5
0
 public void RetryOnlySpecificException()
 {
     // Execute the DoWork and only retry with an exception that is of (base)type DbException
     Retry.Execute(() => DummyMethods.DoWork("Hello world"), TimeSpan.FromMilliseconds(100), 2,
                   exceptionTypesToHandle: typeof(DbException));
 }