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

ContextualPolicy

public class ContextualPolicy
Transient exception handling policies that can be applied to delegates. These policies can be called with arbitrary context data.
public void Execute(Action action, IDictionary<string, object> contextData)

Executes the specified action within the policy.

public void Execute(Action action)

Executes the specified action within the policy.

public TResult Execute<TResult>(Func<TResult> action, IDictionary<string, object> contextData)

Executes the specified action within the policy and returns the result.

public TResult Execute<TResult>(Func<TResult> action)

Executes the specified action within the policy and returns the result.