示例#1
0
 /// <summary>
 /// Execute the Func.
 /// </summary>
 /// <typeparam name="TClass">Class with methods.</typeparam>
 /// <typeparam name="TException">Type of exception of the exception handler.</typeparam>
 /// <typeparam name="TResult">Type of result.</typeparam>
 /// <param name="codeExecutorBuilder"><see cref="CodeExecutorBuilder{TClass, TException}"/>.</param>
 /// <param name="func">Executed Func.</param>
 /// <param name="defaultResult">Default result if exception will occured.</param>
 /// <returns>
 /// Returns result.
 /// </returns>
 public static TResult Start <TClass, TException, TResult>(this CodeExecutorBuilder <TClass, TException> codeExecutorBuilder, Func <TResult> func, TResult defaultResult = default) where TClass : class where TException : Exception
 {
     return(codeExecutorBuilder.Execute(func, defaultResult));
 }
示例#2
0
 /// <summary>
 /// Execute the Task.
 /// </summary>
 /// <typeparam name="TClass">Class with methods.</typeparam>
 /// <typeparam name="TException">Type of exception of the exception handler.</typeparam>
 /// <typeparam name="TResult">Type of result.</typeparam>
 /// <param name="codeExecutorBuilder"><see cref="CodeExecutorBuilder{TClass, TException}"/>.</param>
 /// <param name="task">Executed Task.</param>
 /// <param name="defaultResult">Default result if exception will occured.</param>
 /// <returns>
 /// Returns result.
 /// </returns>
 public static async ValueTask <TResult> StartAsync <TClass, TException, TResult>(this CodeExecutorBuilder <TClass, TException> codeExecutorBuilder, ValueTask <TResult> task, TResult defaultResult = default) where TClass : class where TException : Exception
 {
     return(await codeExecutorBuilder.ExecuteAsync(task, defaultResult).ConfigureAwait(false));
 }
示例#3
0
 /// <summary>
 /// Execute the Task.
 /// </summary>
 /// <typeparam name="TClass">Class with methods.</typeparam>
 /// <typeparam name="TException">Type of exception of the exception handler.</typeparam>
 /// <param name="codeExecutorBuilder"><see cref="CodeExecutorBuilder{TClass, TException}"/>.</param>
 /// <param name="task">Executed Task.</param>
 /// <param name="iterations">Number of executing Task iterations.</param>
 public static async ValueTask StartAsync <TClass, TException>(this CodeExecutorBuilder <TClass, TException> codeExecutorBuilder, ValueTask task, uint iterations = 1) where TClass : class where TException : Exception
 {
     await codeExecutorBuilder.ExecuteAsync(task, iterations).ConfigureAwait(false);
 }
示例#4
0
 /// <summary>
 /// Execute the Action.
 /// </summary>
 /// <typeparam name="TClass">Class with methods.</typeparam>
 /// <typeparam name="TException">Type of exception of the exception handler.</typeparam>
 /// <param name="codeExecutorBuilder"><see cref="CodeExecutorBuilder{TClass, TException}"/>.</param>
 /// <param name="action">Executed Action.</param>
 /// <param name="iterations">Number of executing Action iterations.</param>
 public static void Start <TClass, TException>(this CodeExecutorBuilder <TClass, TException> codeExecutorBuilder, Action action, uint iterations = 1) where TClass : class where TException : Exception
 {
     codeExecutorBuilder.Execute(action, iterations);
 }
示例#5
0
 /// <summary>
 /// Set exception handler for executed code.
 /// </summary>
 /// <typeparam name="TClass">Class with methods.</typeparam>
 /// <typeparam name="TException">Type of exception of the exception handler.</typeparam>
 /// <param name="codeExecutorBuilder"><see cref="CodeExecutorBuilder{TClass, TException}"/>.</param>
 /// <param name="exceptionHandler">Exception handler for executed code.</param>
 /// <returns>
 /// Returns <see cref="CodeExecutorBuilder{TClass, TException}"/>.
 /// </returns>
 public static CodeExecutorBuilder <TClass, TException> WithExceptionHandler <TClass, TException>(this CodeExecutorBuilder <TClass, TException> codeExecutorBuilder, Action <TException> exceptionHandler) where TClass : class where TException : Exception
 {
     return(codeExecutorBuilder.WithExceptionHandler(exceptionHandler));
 }
示例#6
0
 /// <summary>
 /// Stop watching when executing the code.
 /// </summary>
 /// <typeparam name="TClass">Class with methods.</typeparam>
 /// <typeparam name="TException">Type of exception of the exception handler.</typeparam>
 /// <param name="codeExecutorBuilder"><see cref="CodeExecutorBuilder{TClass, TException}"/>.</param>
 /// <returns>
 /// Returns <see cref="CodeExecutorBuilder{TClass, TException}"/>.
 /// </returns>
 public static CodeExecutorBuilder <TClass, TException> WithoutWatching <TClass, TException>(this CodeExecutorBuilder <TClass, TException> codeExecutorBuilder) where TClass : class where TException : Exception
 {
     return(codeExecutorBuilder.WithoutWatching());
 }
示例#7
0
 /// <summary>
 /// Execute the Task.
 /// </summary>
 /// <typeparam name="TClass">Class with methods.</typeparam>
 /// <typeparam name="TException">Type of exception of the exception handler.</typeparam>
 /// <param name="codeExecutorBuilder"><see cref="CodeExecutorBuilder{TClass, TException}"/>.</param>
 /// <param name="task">Executed Task.</param>
 public static async Task StartAsync <TClass, TException>(this CodeExecutorBuilder <TClass, TException> codeExecutorBuilder, Task task) where TClass : class where TException : Exception
 {
     await codeExecutorBuilder.ExecuteAsync(task).ConfigureAwait(false);
 }