<PackageReference Include="Polly.Core" Version="8.0.0-beta.1" />

HedgingStrategyOptions<TResult>

Hedging strategy options.
using Polly.Utils; using System; using System.ComponentModel.DataAnnotations; using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace Polly.Hedging { public class HedgingStrategyOptions<[System.Runtime.CompilerServices.Nullable(2)] TResult> : ResilienceStrategyOptions { public TimeSpan Delay { get; set; } = HedgingConstants.DefaultHedgingDelay; [Range(1, 10)] public int MaxHedgedAttempts { get; set; } = 1; [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 0 })] [Required] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 0 })] public Func<HedgingPredicateArguments<TResult>, ValueTask<bool>> ShouldHandle { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 0 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 0 })] set; } = DefaultPredicates<HedgingPredicateArguments<TResult>, TResult>.HandleOutcome; [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2, 0, 0, 1 })] [Required] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2, 0, 0, 1 })] public Func<HedgingActionGeneratorArguments<TResult>, Func<ValueTask<Outcome<TResult>>>> ActionGenerator { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2, 0, 0, 1 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2, 0, 0, 1 })] set; } [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0 })] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0 })] public Func<HedgingDelayGeneratorArguments, ValueTask<TimeSpan>> DelayGenerator { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0 })] set; } [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0, 1 })] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0, 1 })] public Func<OnHedgingArguments<TResult>, ValueTask> OnHedging { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0, 1 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0, 1 })] set; } public HedgingStrategyOptions() { object <>4__this; ActionGenerator = ((HedgingActionGeneratorArguments<TResult> args) => delegate { <>c__DisplayClass0_0.<<-ctor>b__1>d stateMachine = default(<>c__DisplayClass0_0.<<-ctor>b__1>d); stateMachine.<>t__builder = AsyncValueTaskMethodBuilder<Outcome<TResult>>.Create(); stateMachine.<>4__this = (<>c__DisplayClass0_0)<>4__this; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; }); base..ctor(); base.Name = "Hedging"; } } }