PolicyWrap
A policy that allows two (and by recursion more) Polly policies to wrap executions of delegates.
using Polly.Utilities;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Polly.Wrap
{
public class PolicyWrap : Policy
{
internal override void SetPolicyContext(Context executionContext)
{
if (executionContext.PolicyWrapKey == null)
executionContext.PolicyWrapKey = base.PolicyKey;
base.SetPolicyContext(executionContext);
}
internal PolicyWrap(Action<Action<CancellationToken>, Context, CancellationToken> policyAction)
: base(policyAction, PredicateHelper.EmptyExceptionPredicates)
{
}
internal PolicyWrap(Func<Func<CancellationToken, Task>, Context, CancellationToken, bool, Task> policyAction)
: base(policyAction, PredicateHelper.EmptyExceptionPredicates)
{
}
}
}