Beispiel #1
0
 /// <summary>
 /// Executes retry action
 /// </summary>
 /// <typeparam name="TArgument">Type of Argument of extension</typeparam>
 /// <param name="context">Context which proceeded by WithRetryFunc</param>
 /// <param name="func">The function which will be retried</param>
 public static void Retry <TArgument>(this IFluentContext <TArgument> context, Action <TArgument> func)
 {
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     if (func == null)
     {
         throw new ArgumentNullException(nameof(func));
     }
     context.RetryFunc(context.Argument, func);
 }
Beispiel #2
0
 /// <summary>
 /// Executes retry function
 /// </summary>
 /// <typeparam name="TArgument">Type of Argument of extension</typeparam>
 /// <typeparam name="TResult">Type of Result of the function</typeparam>
 /// <param name="context">Context which proceeded by WithRetryFunc</param>
 /// <param name="func">The function which will be retried</param>
 /// <returns>Result of the function or throw some exception</returns>
 /// <exception cref="ArgumentNullException">Context or func cannot be null</exception>
 public static TResult Retry <TArgument, TResult>(this IFluentContext <TArgument, TResult> context,
                                                  Func <TArgument, TResult> func)
 {
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     if (func == null)
     {
         throw new ArgumentNullException(nameof(func));
     }
     return(context.RetryFunc(context.Argument, func));
 }