Skip to content

Commit 38d903e

Browse files
authored
Update docs. (#1413)
1 parent 8bc1658 commit 38d903e

14 files changed

+134
-139
lines changed

src/Polly.Core/CircuitBreaker/AdvancedCircuitBreakerStrategyOptions.TResult.cs

+7-11
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,27 @@ public class AdvancedCircuitBreakerStrategyOptions<TResult> : CircuitBreakerStra
2727
/// </summary>
2828
/// <remarks>
2929
/// A number between zero and one (inclusive) e.g. 0.5 represents breaking if 50% or more of actions result in a handled failure.
30-
/// <para>
31-
/// A ratio number higher than 0, up to 1.
32-
/// Defaults to 0.1 (i.e. 10%).
33-
/// </para>
3430
/// </remarks>
31+
/// <value>A ratio number higher than 0, up to 1. The default value is 0.1 (i.e. 10%).</value>
3532
[Range(0, 1.0)]
3633
public double FailureThreshold { get; set; } = CircuitBreakerConstants.DefaultAdvancedFailureThreshold;
3734

3835
/// <summary>
3936
/// Gets or sets the minimum throughput: this many actions or more must pass through the circuit in the time-slice,
4037
/// for statistics to be considered significant and the circuit-breaker to come into action.
4138
/// </summary>
42-
/// <remarks>
43-
/// Value must be 2 or greater.
44-
/// Defaults to 100.
45-
/// </remarks>
39+
/// <value>
40+
/// The default value is 0.1 (i.e. 10%). The value must be 2 or greater.
41+
/// </value>
4642
[Range(CircuitBreakerConstants.MinimumValidThroughput, int.MaxValue)]
4743
public int MinimumThroughput { get; set; } = CircuitBreakerConstants.DefaultMinimumThroughput;
4844

4945
/// <summary>
5046
/// Gets or sets the duration of the sampling over which failure ratios are assessed.
5147
/// </summary>
52-
/// <remarks>
53-
/// Value must be greater than 0.5 seconds. Defaults to 30 seconds.
54-
/// </remarks>
48+
/// <value>
49+
/// The default value is 30 seconds. Value must be greater than 0.5 seconds.
50+
/// </value>
5551
[Range(typeof(TimeSpan), "00:00:00.500", "1.00:00:00")]
5652
public TimeSpan SamplingDuration { get; set; } = CircuitBreakerConstants.DefaultSamplingDuration;
5753
}

src/Polly.Core/CircuitBreaker/CircuitBreakerStrategyOptions.cs

+11-22
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,19 @@ public abstract class CircuitBreakerStrategyOptions<TResult> : ResilienceStrateg
2626
/// <summary>
2727
/// Gets or sets the duration of break the circuit will stay open before resetting.
2828
/// </summary>
29-
/// <remarks>
30-
/// Value must be greater than 0.5 seconds.
31-
/// Defaults to 5 seconds.
32-
/// </remarks>
29+
/// <value>
30+
/// The default value is 5 seconds. Value must be greater than 0.5 seconds.
31+
/// </value>
3332
[Range(typeof(TimeSpan), "00:00:00.500", "1.00:00:00")]
3433
public TimeSpan BreakDuration { get; set; } = CircuitBreakerConstants.DefaultBreakDuration;
3534

3635
/// <summary>
3736
/// Gets or sets the predicates for the circuit breaker.
3837
/// </summary>
39-
/// <remarks>
40-
/// Defaults to a delegate that handles circuit breaker on any exception except <see cref="OperationCanceledException"/>.
38+
/// <value>
39+
/// The default value is a predicate that handles circuit breaker on any exception except <see cref="OperationCanceledException"/>.
4140
/// This property is required.
42-
/// </remarks>
41+
/// </value>
4342
[Required]
4443
public Func<OutcomeArguments<TResult, CircuitBreakerPredicateArguments>, ValueTask<bool>> ShouldHandle { get; set; } = DefaultPredicates<CircuitBreakerPredicateArguments, TResult>.HandleOutcome;
4544

@@ -55,10 +54,8 @@ public abstract class CircuitBreakerStrategyOptions<TResult> : ResilienceStrateg
5554
/// However, the invocation order of the <see cref="OnOpened"/>, <see cref="OnClosed"/>, and <see cref="OnHalfOpened"/> events is always
5655
/// maintained to ensure the correct sequence of state transitions.
5756
/// </para>
58-
/// <para>
59-
/// Defaults to <see langword="null"/>.
60-
/// </para>
6157
/// </remarks>
58+
/// <value>The default value is <see langword="null"/>.</value>
6259
public Func<OutcomeArguments<TResult, OnCircuitClosedArguments>, ValueTask>? OnClosed { get; set; }
6360

6461
/// <summary>
@@ -73,10 +70,8 @@ public abstract class CircuitBreakerStrategyOptions<TResult> : ResilienceStrateg
7370
/// However, the invocation order of the <see cref="OnOpened"/>, <see cref="OnClosed"/>, and <see cref="OnHalfOpened"/> events is always
7471
/// maintained to ensure the correct sequence of state transitions.
7572
/// </para>
76-
/// <para>
77-
/// Defaults to <see langword="null"/>.
78-
/// </para>
7973
/// </remarks>
74+
/// <value>The default value is <see langword="null"/>.</value>
8075
public Func<OutcomeArguments<TResult, OnCircuitOpenedArguments>, ValueTask>? OnOpened { get; set; }
8176

8277
/// <summary>
@@ -91,26 +86,20 @@ public abstract class CircuitBreakerStrategyOptions<TResult> : ResilienceStrateg
9186
/// However, the invocation order of the <see cref="OnOpened"/>, <see cref="OnClosed"/>, and <see cref="OnHalfOpened"/> events is always
9287
/// maintained to ensure the correct sequence of state transitions.
9388
/// </para>
94-
/// <para>
95-
/// Defaults to <see langword="null"/>.
96-
/// </para>
9789
/// </remarks>
90+
/// <value>The default value is <see langword="null"/>.</value>
9891
public Func<OnCircuitHalfOpenedArguments, ValueTask>? OnHalfOpened { get; set; }
9992

10093
/// <summary>
10194
/// Gets or sets the manual control for the circuit breaker.
10295
/// </summary>
103-
/// <remarks>
104-
/// Defaults to <see langword="null"/>.
105-
/// </remarks>
96+
/// <value>The default value is <see langword="null"/>.</value>
10697
public CircuitBreakerManualControl? ManualControl { get; set; }
10798

10899
/// <summary>
109100
/// Gets or sets the state provider for the circuit breaker.
110101
/// </summary>
111-
/// <remarks>
112-
/// Defaults to <see langword="null"/>.
113-
/// </remarks>
102+
/// <value>The default value is <see langword="null"/>.</value>
114103
public CircuitBreakerStateProvider? StateProvider { get; set; }
115104
}
116105

src/Polly.Core/CircuitBreaker/SimpleCircuitBreakerStrategyOptions.TResult.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public class SimpleCircuitBreakerStrategyOptions<TResult> : CircuitBreakerStrate
2323
/// <summary>
2424
/// Gets or sets the number of the outcome failures handled by <see cref="CircuitBreakerStrategyOptions{TResult}.ShouldHandle"/> before opening the circuit.
2525
/// </summary>
26-
/// <remarks>
27-
/// Must be greater than 0. Defaults to 100.
28-
/// </remarks>
26+
/// <value>
27+
/// The default value is 100. Must be greater than 0.
28+
/// </value>
2929
[Range(1, int.MaxValue)]
3030
public int FailureThreshold { get; set; } = CircuitBreakerConstants.DefaultFailureThreshold;
3131
}

src/Polly.Core/Fallback/FallbackStrategyOptions.TResult.cs

+9-10
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,27 @@ public class FallbackStrategyOptions<TResult> : ResilienceStrategyOptions
1717
/// <summary>
1818
/// Gets or sets the outcome predicate for determining whether a fallback should be executed.
1919
/// </summary>
20-
/// <remarks>
21-
/// Defaults to a delegate that hedges on any exception except <see cref="OperationCanceledException"/>.
22-
/// This property is required.
23-
/// </remarks>
20+
/// <value>
21+
/// The default value is a predicate that fallbacks on any exception except <see cref="OperationCanceledException"/>. This property is required.
22+
/// </value>
2423
[Required]
2524
public Func<OutcomeArguments<TResult, FallbackPredicateArguments>, ValueTask<bool>> ShouldHandle { get; set; } = DefaultPredicates<FallbackPredicateArguments, TResult>.HandleOutcome;
2625

2726
/// <summary>
2827
/// Gets or sets the fallback action to be executed when the <see cref="ShouldHandle"/> predicate evaluates as true.
2928
/// </summary>
30-
/// <remarks>
31-
/// This property is required. Defaults to <see langword="null"/>.
32-
/// </remarks>
29+
/// <value>
30+
/// The default value is <see langword="null"/>. This property is required.
31+
/// </value>
3332
[Required]
3433
public Func<OutcomeArguments<TResult, FallbackPredicateArguments>, ValueTask<Outcome<TResult>>>? FallbackAction { get; set; }
3534

3635
/// <summary>
3736
/// Gets or sets the outcome event instance responsible for triggering fallback events.
3837
/// </summary>
39-
/// <remarks>
40-
/// Defaults to <see langword="null"/> instance.
41-
/// </remarks>
38+
/// <value>
39+
/// The default value is <see langword="null"/> instance.
40+
/// </value>
4241
public Func<OutcomeArguments<TResult, OnFallbackArguments>, ValueTask>? OnFallback { get; set; }
4342
}
4443

src/Polly.Core/Hedging/HedgingStrategyOptions.TResult.cs

+18-16
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,45 @@ public class HedgingStrategyOptions<TResult> : ResilienceStrategyOptions
1818
/// Gets or sets the minimal time of waiting before spawning a new hedged call.
1919
/// </summary>
2020
/// <remarks>
21-
/// Defaults to 2 seconds.
22-
/// <para>
2321
/// You can also use <see cref="TimeSpan.Zero"/> to create all hedged tasks (value of <see cref="MaxHedgedAttempts"/>) at once
2422
/// or <see cref="System.Threading.Timeout.InfiniteTimeSpan"/> to force the hedging strategy to never create new task before the old one is finished.
25-
/// </para>
2623
/// <para> If you want a greater control over hedging delay customization use <see cref="HedgingDelayGenerator"/>.</para>
2724
/// </remarks>
25+
/// <value>
26+
/// The default value is 2 seconds.
27+
/// </value>
2828
public TimeSpan HedgingDelay { get; set; } = HedgingConstants.DefaultHedgingDelay;
2929

3030
/// <summary>
3131
/// Gets or sets the maximum hedged attempts to perform the desired task.
3232
/// </summary>
3333
/// <remarks>
34-
/// Defaults to 2. The value must be bigger or equal to 2, and lower or equal to 10.
35-
/// <para>
3634
/// The value defines how many concurrent hedged tasks will be triggered by the strategy.
3735
/// This includes the primary hedged task that is initially performed, and the further tasks that will
3836
/// be fetched from the provider and spawned in parallel.
39-
/// </para>
4037
/// </remarks>
38+
/// <value>
39+
/// The default value is 2. The value must be bigger or equal to 2, and lower or equal to 10.
40+
/// </value>
4141
[Range(HedgingConstants.MinimumHedgedAttempts, HedgingConstants.MaximumHedgedAttempts)]
4242
public int MaxHedgedAttempts { get; set; } = HedgingConstants.DefaultMaxHedgedAttempts;
4343

4444
/// <summary>
4545
/// Gets or sets the predicate that determines whether a hedging should be performed for a given result.
4646
/// </summary>
47-
/// <remarks>
48-
/// Defaults to a delegate that hedges on any exception except <see cref="OperationCanceledException"/>.
47+
/// <value>
48+
/// The default value is a predicate that hedges on any exception except <see cref="OperationCanceledException"/>.
4949
/// This property is required.
50-
/// </remarks>
50+
/// </value>
5151
[Required]
5252
public Func<OutcomeArguments<TResult, HedgingPredicateArguments>, ValueTask<bool>> ShouldHandle { get; set; } = DefaultPredicates<HedgingPredicateArguments, TResult>.HandleOutcome;
5353

5454
/// <summary>
5555
/// Gets or sets the hedging action generator that creates hedged actions.
5656
/// </summary>
57-
/// <remarks>
58-
/// This property is required. The default delegate executes the original callback that was passed to the hedging resilience strategy.
59-
/// </remarks>
57+
/// <value>
58+
/// The default generator executes the original callback that was passed to the hedging resilience strategy. This property is required.
59+
/// </value>
6060
[Required]
6161
public Func<HedgingActionGeneratorArguments<TResult>, Func<ValueTask<Outcome<TResult>>>?> HedgingActionGenerator { get; set; } = args =>
6262
{
@@ -76,19 +76,21 @@ public class HedgingStrategyOptions<TResult> : ResilienceStrategyOptions
7676
/// </summary>
7777
/// <remarks>
7878
/// The <see cref="HedgingDelayGenerator"/> takes precedence over <see cref="HedgingDelay"/>. If specified, the <see cref="HedgingDelay"/> is ignored.
79-
/// <para>Defaults to <see langword="null"/>.</para>
8079
/// </remarks>
80+
/// <value>
81+
/// The default value is <see langword="null"/>.
82+
/// </value>
8183
public Func<HedgingDelayArguments, ValueTask<TimeSpan>>? HedgingDelayGenerator { get; set; }
8284

8385
/// <summary>
8486
/// Gets or sets the event that is raised when a hedging is performed.
8587
/// </summary>
8688
/// <remarks>
87-
/// Defaults to <see langword="null"/>.
88-
/// <para>
8989
/// The hedging is executed when the current attempt outcome is not successful and the <see cref="ShouldHandle"/> predicate returns <see langword="true"/> or when
9090
/// the current attempt did not finish within the <see cref="HedgingDelay"/>.
91-
/// </para>
9291
/// </remarks>
92+
/// <value>
93+
/// The default value is <see langword="null"/>.
94+
/// </value>
9395
public Func<OutcomeArguments<TResult, OnHedgingArguments>, ValueTask>? OnHedging { get; set; }
9496
}

src/Polly.Core/PredicateBuilder.TResult.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public PredicateBuilder<TResult> HandleResult(Func<TResult, bool> predicate)
7272
/// Adds a predicate for handling results with a specific value.
7373
/// </summary>
7474
/// <param name="result">The result value to handle.</param>
75-
/// <param name="comparer">The comparer to use for comparing results. If null, the default comparer is used.</param>
75+
/// <param name="comparer">The comparer to use for comparing results. If <see langword="null"/> , the default comparer is used.</param>
7676
/// <returns>The same instance of the <see cref="PredicateBuilder{TResult}"/> for chaining.</returns>
7777
public PredicateBuilder<TResult> HandleResult(TResult result, IEqualityComparer<TResult>? comparer = null)
7878
{

src/Polly.Core/Registry/ResilienceStrategyRegistryOptions.cs

+15-15
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ public class ResilienceStrategyRegistryOptions<TKey>
1111
/// <summary>
1212
/// Gets or sets the factory method that creates instances of <see cref="ResilienceStrategyBuilder"/>.
1313
/// </summary>
14-
/// <remarks>
15-
/// By default, the factory method creates a new instance of <see cref="ResilienceStrategyBuilder"/> using the default constructor.
16-
/// </remarks>
14+
/// <value>
15+
/// The default value is a function that creates a new instance of <see cref="ResilienceStrategyBuilder"/> using the default constructor.
16+
/// </value>
1717
[Required]
1818
public Func<ResilienceStrategyBuilder> BuilderFactory { get; set; } = static () => new ResilienceStrategyBuilder();
1919

2020
/// <summary>
2121
/// Gets or sets the comparer that is used by the registry to retrieve the resilience strategies.
2222
/// </summary>
23-
/// <remarks>
24-
/// By default, the comparer uses the default equality comparer for <typeparamref name="TKey"/>.
25-
/// </remarks>
23+
/// <value>
24+
/// The default value is <see cref="EqualityComparer{T}.Default"/>.
25+
/// </value>
2626
[Required]
2727
public IEqualityComparer<TKey> StrategyComparer { get; set; } = EqualityComparer<TKey>.Default;
2828

2929
/// <summary>
3030
/// Gets or sets the comparer that is used by the registry to retrieve the resilience strategy builders.
3131
/// </summary>
32-
/// <remarks>
33-
/// By default, the comparer uses the default equality comparer for <typeparamref name="TKey"/>.
34-
/// </remarks>
32+
/// <value>
33+
/// The default value is <see cref="EqualityComparer{T}.Default"/>.
34+
/// </value>
3535
[Required]
3636
public IEqualityComparer<TKey> BuilderComparer { get; set; } = EqualityComparer<TKey>.Default;
3737

@@ -40,25 +40,25 @@ public class ResilienceStrategyRegistryOptions<TKey>
4040
/// represents the instance name of the builder.
4141
/// </summary>
4242
/// <remarks>
43-
/// Defaults to <see langword="null"/>.
44-
/// <para>
4543
/// Use custom formatter for composite keys in case you want to have different metric values for a builder and instance key.
4644
/// In general, strategies can have the same builder name and different instance names.
47-
/// </para>
4845
/// </remarks>
46+
/// <value>
47+
/// The default value is <see langword="null"/>.
48+
/// </value>
4949
public Func<TKey, string>? InstanceNameFormatter { get; set; }
5050

5151
/// <summary>
5252
/// Gets or sets the formatter that is used by the registry to format the <typeparamref name="TKey"/> to a string that
5353
/// represents the builder name.
5454
/// </summary>
5555
/// <remarks>
56-
/// By default, the formatter uses the <see cref="object.ToString"/> method.
57-
/// <para>
5856
/// Use custom formatter for composite keys in case you want to have different metric values for a builder and strategy key.
5957
/// In general, strategies can have the same builder name and different strategy keys.
60-
/// </para>
6158
/// </remarks>
59+
/// <value>
60+
/// The default value is a formatter that formats the keys using the <see cref="object.ToString"/> method.
61+
/// </value>
6262
[Required]
6363
public Func<TKey, string> BuilderNameFormatter { get; set; } = (key) => key?.ToString() ?? string.Empty;
6464
}

src/Polly.Core/ResilienceContext.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ private ResilienceContext()
3232
/// Resilience strategy instances are commonly reused across multiple call sites.
3333
/// Set an <see cref="OperationKey"/> so that logging and metrics can distinguish usages of policy instances at different call sites.
3434
/// The operation key value should have a low cardinality (i.e. do not assign values such as <see cref="Guid"/> to this property).
35-
/// <para>
36-
/// Defaults to <see langword="null"/>.
37-
/// </para>
3835
/// </remarks>
36+
/// <value>The default value is <see langword="null"/>.</value>
3937
public string? OperationKey { get; private set; }
4038

4139
/// <summary>

0 commit comments

Comments
 (0)