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

AsyncPolicy

public abstract class AsyncPolicy : PolicyBase, IAsyncPolicy, IsPolicy
Transient exception handling policies that can be applied to asynchronous delegates.
protected AsyncPolicy(PolicyBuilder policyBuilder = null)

Initializes a new instance of the AsyncPolicy class.

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

public Task<PolicyResult> ExecuteAndCaptureAsync(Func<Context, Task> action, IDictionary<string, object> contextData)

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

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

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

public Task<PolicyResult> ExecuteAndCaptureAsync(Func<Context, CancellationToken, Task> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

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

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

public Task<PolicyResult> ExecuteAndCaptureAsync(Func<CancellationToken, Task> action, CancellationToken cancellationToken, bool continueOnCapturedContext)

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

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

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

public Task<PolicyResult> ExecuteAndCaptureAsync(Func<Context, CancellationToken, Task> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)

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

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<Task<TResult>> action)

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

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<Context, Task<TResult>> action, IDictionary<string, object> contextData)

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

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<Context, Task<TResult>> action, Context context)

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

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<CancellationToken, Task<TResult>> action, CancellationToken cancellationToken)

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

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

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

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken)

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

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<CancellationToken, Task<TResult>> action, CancellationToken cancellationToken, bool continueOnCapturedContext)

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

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

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

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)

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

public Task ExecuteAsync(Func<Task> action)

Executes the specified asynchronous action within the policy.

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

Executes the specified asynchronous action within the policy.

public Task ExecuteAsync(Func<Context, Task> action, Context context)

Executes the specified asynchronous action within the policy.

public Task ExecuteAsync(Func<CancellationToken, Task> action, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy.

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

Executes the specified asynchronous action within the policy.

public Task ExecuteAsync(Func<Context, CancellationToken, Task> action, Context context, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy.

public Task ExecuteAsync(Func<CancellationToken, Task> action, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy.

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

Executes the specified asynchronous action within the policy.

public Task ExecuteAsync(Func<Context, CancellationToken, Task> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy.

public Task<TResult> ExecuteAsync<TResult>(Func<Task<TResult>> action)

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

public Task<TResult> ExecuteAsync<TResult>(Func<Context, 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<Context, Task<TResult>> action, Context context)

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

public Task<TResult> ExecuteAsync<TResult>(Func<CancellationToken, Task<TResult>> action, CancellationToken cancellationToken)

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

public Task<TResult> ExecuteAsync<TResult>(Func<Context, 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<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken)

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

public Task<TResult> ExecuteAsync<TResult>(Func<CancellationToken, Task<TResult>> action, CancellationToken cancellationToken, bool continueOnCapturedContext)

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

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

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

public Task<TResult> ExecuteAsync<TResult>(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)

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

protected virtual Task ImplementationAsync(Func<Context, CancellationToken, Task> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)

Defines the implementation of a policy for async executions with no return value.

protected abstract Task<TResult> ImplementationAsync<TResult>(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)

Defines the implementation of a policy for async executions returning TResult.

public AsyncPolicy WithPolicyKey(string policyKey)

Sets the PolicyKey for this AsyncPolicy instance. Must be called before the policy is first used. Can only be set once.

Wraps the specified inner policy.

public AsyncPolicyWrap<TResult> WrapAsync<TResult>(IAsyncPolicy<TResult> innerPolicy)

Wraps the specified inner policy.