示例#1
0
 /// <summary>
 /// Create a <see cref="ResilientActionBuilder{TAction}"/> from an existing synchronous action.
 /// </summary>
 /// <param name="action">A synchronous action that is not already resilient.</param>
 /// <returns>A new builder for the operation to configure resiliency.</returns>
 public static ResilientActionBuilder <Action> AsResilient(
     this Action action,
     [CallerLineNumber] int sourceLineNumber = 0,
     [CallerFilePath] string sourceFilePath  = "",
     [CallerMemberName] string memberName    = "")
 {
     return(ResilientOperation.From(action, sourceLineNumber, sourceFilePath, memberName));
 }
示例#2
0
 /// <summary>
 /// Create a <see cref="ResilientFuncBuilder{TFunction, TResult}"/> from an existing synchronous function.
 /// </summary>
 /// <param name="function">A synchronous function that is not already resilient.</param>
 /// <returns>A new builder for the operation to configure resiliency.</returns>
 public static ResilientFuncBuilder <Func <TResult>, TResult> AsResilient <TResult>(
     this Func <TResult> function,
     [CallerLineNumber] int sourceLineNumber = 0,
     [CallerFilePath] string sourceFilePath  = "",
     [CallerMemberName] string memberName    = "")
 {
     return(ResilientOperation.From(function, sourceLineNumber, sourceFilePath, memberName));
 }
示例#3
0
 /// <summary>
 /// Create a <see cref="ResilientActionBuilder{TAction}"/> from an existing async action with cancellation support.
 /// </summary>
 /// <param name="action">An async action, that supports cancellation, that is not already resilient.</param>
 /// <returns>A new builder for the operation to configure resiliency.</returns>
 public static ResilientActionBuilder <Func <CancellationToken, Task> > AsResilient(
     this Func <CancellationToken, Task> action,
     [CallerLineNumber] int sourceLineNumber = 0,
     [CallerFilePath] string sourceFilePath  = "",
     [CallerMemberName] string memberName    = "")
 {
     return(ResilientOperation.From(action, sourceLineNumber, sourceFilePath, memberName));
 }