<PackageReference Include="Polly" Version="5.2.0" />

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, IPolicyWrap, IsPolicy { internal override void SetPolicyContext(Context executionContext) { if (executionContext.PolicyWrapKey == null) executionContext.PolicyWrapKey = base.PolicyKey; base.SetPolicyContext(executionContext); } internal PolicyWrap(Action<Action<Context, CancellationToken>, Context, CancellationToken> policyAction) : base(policyAction, PredicateHelper.EmptyExceptionPredicates) { } internal PolicyWrap(Func<Func<Context, CancellationToken, Task>, Context, CancellationToken, bool, Task> policyAction) : base(policyAction, PredicateHelper.EmptyExceptionPredicates) { } } }