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

ContextualPolicy

public class ContextualPolicy : Policy
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 TResult Execute<TResult>(Func<TResult> action, IDictionary<string, object> contextData)

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

public Task ExecuteAsync(Func<Task> action, IDictionary<string, object> contextData)

Executes the specified asynchronous action within the policy.

public Task ExecuteAsync(Func<Task> action, IDictionary<string, object> contextData, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy.

public Task ExecuteAsync(Func<CancellationToken, Task> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy.

public Task ExecuteAsync(Func<CancellationToken, Task> action, IDictionary<string, object> contextData, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy.

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

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

public Task<TResult> ExecuteAsync<TResult>(Func<Task<TResult>> action, IDictionary<string, object> contextData, bool continueOnCapturedContext)

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

public Task<TResult> ExecuteAsync<TResult>(Func<CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

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

public Task<TResult> ExecuteAsync<TResult>(Func<CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken, bool continueOnCapturedContext)

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