RetryStrategyOptions<TResult>
Represents the options used to configure a retry strategy.
using Polly.Utils;
using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Polly.Retry
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class RetryStrategyOptions<[System.Runtime.CompilerServices.Nullable(2)] TResult> : ResilienceStrategyOptions
{
public sealed override string StrategyType => "Retry";
[Range(-1, 100)]
public int RetryCount { get; set; } = 3;
public RetryBackoffType BackoffType { get; set; }
[Range(typeof(TimeSpan), "00:00:00", "1.00:00:00")]
public TimeSpan BaseDelay { get; set; } = RetryConstants.DefaultBaseDelay;
[System.Runtime.CompilerServices.Nullable(new byte[] {
1,
0,
1,
0
})]
[Required]
[field: System.Runtime.CompilerServices.Nullable(new byte[] {
1,
0,
1,
0
})]
public Func<OutcomeArguments<TResult, RetryPredicateArguments>, 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<RetryPredicateArguments, TResult>.HandleOutcome;
[System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1,
0
})]
[field: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1,
0
})]
public Func<OutcomeArguments<TResult, RetryDelayArguments>, ValueTask<TimeSpan>> RetryDelayGenerator {
[return: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1,
0
})]
get;
[param: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1,
0
})]
set;
}
[System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1,
1
})]
[field: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1,
1
})]
public Func<OutcomeArguments<TResult, OnRetryArguments>, ValueTask> OnRetry {
[return: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1,
1
})]
get;
[param: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1,
1
})]
set;
}
}
}