ResolutionPolicy Class
Definition
- Namespace
- Bodu.Globalization.Calendar.RangeResolution
- Assembly
- Bodu.Globalization.Calendar.dll
- Package
- Bodu.Globalization.Calendar 1.0.1
- Source
- ResolutionPolicy.cs
Captures the resource-level policies that govern duplicate handling, collision handling, priority direction, and observed-date range inclusion.
public sealed class ResolutionPolicy
- Inheritance
-
ResolutionPolicy
- Inherited Members
- Extension Methods
Remarks
The defaults mirror the recommended policy in the schema strategy: duplicates are an error, collisions keep all occurrences, higher priority wins, and the observed (emitted) occurrence controls range inclusion.
// The policy is authored on the document; the builder route sets each knob fluently
// (the XML form is the <ResolutionPolicy> element):
NotableDateResource resource = NotableDateDocumentBuilder.Create("demo")
.WithResolutionPolicy(p => p
.WithDuplicatePolicy(DuplicatePolicy.KeepFirst)
.WithSameDayCollisionPolicy(CollisionPolicy.HighestPriorityOnly)
.WithCategoryPrecedence(NotableDateCategory.PublicHoliday, NotableDateCategory.Observance))
.AddNotableDate("new-year", "New Year's Day", NotableDateCategory.PublicHoliday, c => c
.AddRule("default", r => r.Fixed(1, 1)))
.Build();
Constructors
ResolutionPolicy(DuplicatePolicy, CollisionPolicy, CollisionPolicy, PriorityDirection, ObservedDateRangePolicy, WeekPattern?, IReadOnlyList<NotableDateCategory>?)
Initializes a new instance of the ResolutionPolicy class.
public ResolutionPolicy(DuplicatePolicy duplicatePolicy = DuplicatePolicy.Error, CollisionPolicy sameDayCollisionPolicy = CollisionPolicy.KeepAll, CollisionPolicy spanCollisionPolicy = CollisionPolicy.KeepAll, PriorityDirection priorityDirection = PriorityDirection.HigherWins, ObservedDateRangePolicy observedDateRangePolicy = ObservedDateRangePolicy.ObservedOccurrenceControlsInclusion, WeekPattern? workingWeek = null, IReadOnlyList<NotableDateCategory>? categoryPrecedence = null)
Parameters
duplicatePolicyDuplicatePolicyThe policy applied when two rules resolve to the same identity.
sameDayCollisionPolicyCollisionPolicyThe policy applied when distinct notable dates resolve to the same day.
spanCollisionPolicyCollisionPolicyThe policy applied when distinct notable dates resolve to overlapping spans.
priorityDirectionPriorityDirectionThe direction in which numeric priority is interpreted.
observedDateRangePolicyObservedDateRangePolicyThe occurrence that controls range-query inclusion.
workingWeekWeekPattern?The working week that defines which weekdays are working days, or null for the default Monday-to-Friday working week (a Saturday and Sunday weekend).
categoryPrecedenceIReadOnlyList<NotableDateCategory>The category precedence, highest-winning first, applied by CategoryPriority, or null for the built-in precedence. A partial list is completed with the remaining categories in built-in order so every ranked category retains a position.
Properties
CategoryPrecedence
Gets the category precedence applied by CategoryPriority, highest-winning first.
public IReadOnlyList<NotableDateCategory> CategoryPrecedence { get; }
Property Value
- IReadOnlyList<NotableDateCategory>
The effective category precedence; every ranked category appears exactly once, with any categories an authored list omits appended in built-in order.
Default
Gets a ResolutionPolicy populated with the recommended default values.
public static ResolutionPolicy Default { get; }
Property Value
- ResolutionPolicy
A shared default policy instance.
DuplicatePolicy
Gets the policy applied when two rules resolve to the same identity.
public DuplicatePolicy DuplicatePolicy { get; }
Property Value
- DuplicatePolicy
The configured DuplicatePolicy.
ObservedDateRangePolicy
Gets the occurrence that controls whether a resolved notable date is included by a range query.
public ObservedDateRangePolicy ObservedDateRangePolicy { get; }
Property Value
- ObservedDateRangePolicy
The configured ObservedDateRangePolicy.
PriorityDirection
Gets the direction in which numeric priority is interpreted.
public PriorityDirection PriorityDirection { get; }
Property Value
- PriorityDirection
The configured PriorityDirection.
SameDayCollisionPolicy
Gets the policy applied when distinct notable dates resolve to the same day.
public CollisionPolicy SameDayCollisionPolicy { get; }
Property Value
- CollisionPolicy
The configured same-day CollisionPolicy.
SpanCollisionPolicy
Gets the policy applied when distinct notable dates resolve to overlapping spans.
public CollisionPolicy SpanCollisionPolicy { get; }
Property Value
- CollisionPolicy
The configured span CollisionPolicy.
WorkingWeek
Gets the working week that defines which weekdays are working days, and therefore which are weekend (non-working) days for weekend-sensitive triggers and working-day searches.
public WeekPattern WorkingWeek { get; }
Property Value
- WeekPattern
The configured working-week pattern; MondayToFriday when the resource leaves it unspecified.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |