Class PolicyWrap
A policy that allows two (and by recursion more) Polly policies to wrap executions of delegates.
public class PolicyWrap : Policy, ISyncPolicy, IAsyncPolicy, IPolicyWrap, IsPolicy
- Inheritance
-
PolicyWrap
- Implements
- Inherited Members
Properties
Inner
Returns the next inner IsPolicy in this IPolicyWrap
public IsPolicy Inner { get; }
Property Value
Outer
Returns the outer IsPolicy in this IPolicyWrap
public IsPolicy Outer { get; }
Property Value
Methods
ExecuteAsync<TResult>(Func<Context, CancellationToken, Task<TResult>>, Context, CancellationToken, bool)
Executes the specified action asynchronously within the cache policy and returns the result.
public override Task<TResult> ExecuteAsync<TResult>(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)
Parameters
action
Func<Context, CancellationToken, Task<TResult>>The action to perform.
context
ContextExecution context that is passed to the exception policy; defines the cache key to use in cache lookup.
cancellationToken
CancellationTokenThe cancellation token.
continueOnCapturedContext
boolWhether to continue on a captured synchronization context.
Returns
- Task<TResult>
The value returned by the action, or the cache.
Type Parameters
TResult
The type of the result.
Execute<TResult>(Func<Context, CancellationToken, TResult>, Context, CancellationToken)
Executes the specified action within the cache policy and returns the result.
public override TResult Execute<TResult>(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
Parameters
action
Func<Context, CancellationToken, TResult>The action to perform.
context
ContextExecution context that is passed to the exception policy; defines the cache key to use in cache lookup.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- TResult
The value returned by the action, or the cache.
Type Parameters
TResult
The type of the result.