Table of Contents

Class ResilienceStrategy

Namespace
Polly
Assembly
Polly.Core.dll

Base class for all proactive resilience strategies.

public abstract class ResilienceStrategy
Inheritance
ResilienceStrategy
Derived
Inherited Members

Methods

ExecuteCore<TResult, TState>(Func<ResilienceContext, TState, ValueTask<Outcome<TResult>>>, ResilienceContext, TState)

An implementation of a proactive resilience strategy that executes the specified callback.

protected abstract ValueTask<Outcome<TResult>> ExecuteCore<TResult, TState>(Func<ResilienceContext, TState, ValueTask<Outcome<TResult>>> callback, ResilienceContext context, TState state)

Parameters

callback Func<ResilienceContext, TState, ValueTask<Outcome<TResult>>>

The user-provided callback.

context ResilienceContext

The context associated with the callback.

state TState

The state associated with the callback.

Returns

ValueTask<Outcome<TResult>>

An instance of a pending ValueTask for asynchronous executions or a completed ValueTask task for synchronous executions.

Type Parameters

TResult

The type of result returned by the callback.

TState

The type of state associated with the callback.

Remarks

The provided callback never throws an exception. Instead, the exception is captured and converted to an Outcome<TResult>. Similarly, do not throw exceptions from your strategy implementation. Instead, return an exception instance as Outcome<TResult>.