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

Policy

public class Policy
Transient exception handling policies that can be applied to delegates
public static PolicyBuilder Handle<TException>() where TException : Exception

Specifies the type of exception that this policy can handle.

public static PolicyBuilder Handle<TException>(Func<TException, bool> exceptionPredicate) where TException : Exception

Specifies the type of exception that this policy can handle with addition filters on this exception type.

public void Execute(Action action)

Executes the specified action within the policy.

protected void Execute(Action action, Context context)

Executes the specified action within the policy.

protected TResult Execute<TResult>(Func<TResult> action, Context context)

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.

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

protected PolicyResult ExecuteAndCapture(Action action, Context context)

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

public PolicyResult<TResult> ExecuteAndCapture<TResult>(Func<TResult> action)

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

protected PolicyResult<TResult> ExecuteAndCapture<TResult>(Func<TResult> action, Context context)

Executes the specified 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<Task> action, bool continueOnCapturedContext)

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

protected Task<PolicyResult> ExecuteAndCaptureAsync(Func<Task> action, Context context, bool continueOnCapturedContext)

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<CancellationToken, Task> action, CancellationToken cancellationToken, bool continueOnCapturedContext)

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

protected Task<PolicyResult> ExecuteAndCaptureAsync(Func<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.

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

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

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

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

protected Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<Task<TResult>> action, Context context, bool continueOnCapturedContext)

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

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

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

protected Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<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.

protected Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<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.

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

Executes the specified asynchronous action within the policy.

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

Executes the specified asynchronous action within the policy.

protected Task ExecuteAsync(Func<Task> action, Context context, bool continueOnCapturedContext)

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.

protected Task ExecuteAsync(Func<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.

protected Task ExecuteAsync(Func<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.

protected Task<TResult> ExecuteAsync<TResult>(Func<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.

protected Task<TResult> ExecuteAsync<TResult>(Func<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<Task<TResult>> action, bool continueOnCapturedContext)

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

protected Task<TResult> ExecuteAsync<TResult>(Func<Task<TResult>> action, Context context, bool continueOnCapturedContext)

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.

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

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