Example #1
0
 /// <summary>
 /// Builds a NoOp <see cref="Policy"/> that will execute without any custom behavior.
 /// </summary>
 /// <returns>The policy instance.</returns>
 public static NoOpPolicy NoOp()
 {
     return(new NoOpPolicy(
                (action, context, cancellationToken) => NoOpEngine.Implementation(
                    (ctx, ct) => { action(ctx, ct); return EmptyStruct.Instance; }, context,
                    cancellationToken)
                ));
 }
Example #2
0
 /// <summary>
 /// Builds a NoOp <see cref="Policy"/> that will execute without any custom behavior.
 /// </summary>
 /// <typeparam name="TResult">The type of return values this policy will handle.</typeparam>
 /// <returns>The policy instance.</returns>
 public static NoOpPolicy <TResult> NoOp <TResult>()
 {
     return(new NoOpPolicy <TResult>(
                (func, context, cancellationToken) => NoOpEngine.Implementation(
                    func,
                    cancellationToken)
                ));
 }
Example #3
0
 /// <summary>
 /// Builds a NoOp <see cref="Policy"/> that will execute without any custom behavior.
 /// </summary>
 /// <returns>The policy instance.</returns>
 public static NoOpPolicy NoOpAsync()
 {
     return(new NoOpPolicy(
                (action, context, cancellationToken, continueOnCapturedContext) => NoOpEngine.ImplementationAsync(
                    async ct => { await action(ct).ConfigureAwait(continueOnCapturedContext); return EmptyStruct.Instance; },
                    cancellationToken, continueOnCapturedContext)
                ));
 }
 /// <summary>
 /// Builds a NoOp <see cref="Policy"/> that will execute without any custom behavior.
 /// </summary>
 /// <typeparam name="TResult">The type of return values this policy will handle.</typeparam>
 /// <returns>The policy instance.</returns>
 public static NoOpPolicy <TResult> NoOpAsync <TResult>()
 {
     return(new NoOpPolicy <TResult>(
                (action, context, cancellationToken, continueOnCapturedContext) => NoOpEngine.ImplementationAsync(
                    action,
                    context,
                    cancellationToken, continueOnCapturedContext)
                ));
 }