Table of Contents

Class FallbackStrategyOptions<TResult>

Namespace
Polly.Fallback
Assembly
Polly.Core.dll

Represents the options for configuring a fallback resilience strategy with a specific result type.

public class FallbackStrategyOptions<TResult> : ResilienceStrategyOptions

Type Parameters

TResult

The result type.

Inheritance
FallbackStrategyOptions<TResult>
Inherited Members

Constructors

FallbackStrategyOptions()

Initializes a new instance of the FallbackStrategyOptions<TResult> class.

public FallbackStrategyOptions()

Properties

FallbackAction

Gets or sets the fallback action to be executed when the ShouldHandle predicate evaluates as true.

[Required]
public Func<FallbackActionArguments<TResult>, ValueTask<Outcome<TResult>>>? FallbackAction { get; set; }

Property Value

Func<FallbackActionArguments<TResult>, ValueTask<Outcome<TResult>>>

The default value is null. This property is required.

OnFallback

Gets or sets event delegate that is raised when fallback happens.

public Func<OnFallbackArguments<TResult>, ValueTask>? OnFallback { get; set; }

Property Value

Func<OnFallbackArguments<TResult>, ValueTask>

The default value is null instance.

ShouldHandle

Gets or sets a predicate that determines whether the fallback should be executed for a given outcome.

[Required]
public Func<FallbackPredicateArguments<TResult>, ValueTask<bool>> ShouldHandle { get; set; }

Property Value

Func<FallbackPredicateArguments<TResult>, ValueTask<bool>>

The default value is a predicate that falls back on any exception except OperationCanceledException. This property is required.