DuplicatePolicy Enum
Definition
- Namespace
- Bodu.Globalization.Calendar.RangeResolution
- Assembly
- Bodu.Globalization.Calendar.dll
- Package
- Bodu.Globalization.Calendar 1.3.0
- Source
- DuplicatePolicy.cs
Specifies how the loader treats two concepts, or two rules of one concept, that a document declares with the same identifier.
public enum DuplicatePolicy
- Extension Methods
Fields
Error = 0Report two concepts that share an identifier as
BODU-CAL-DUP-ND, and two rules of one concept that share one asBODU-CAL-DUP-RULE, both load errors. This is the default.KeepFirst = 1Keep the first declaration of a concept identifier, and within it the first declaration of a rule identifier, each at its own position, and discard the later declarations.
KeepLast = 2Keep the last declaration of a concept identifier, and within it the last declaration of a rule identifier, each at its own position, and discard the earlier declarations.
Merge = 3Append the rules of each later declaration of a concept identifier to the first declaration, whose own fields are kept. Rules are not merged: two rules that share an identifier remain a
BODU-CAL-DUP-RULEerror.
Remarks
The loader applies the policy of the document it loads, when it loads it, in document order, to the concepts and
rules that document declares, before it composes the document's imports and applies its overrides. The policy
reaches no further: across imports the first import that supplies a concept wins and a local concept replaces an
imported one with the same identifier, an imported document's own policy is not applied, so two rules sharing an
identifier in an imported concept stay BODU-CAL-DUP-RULE, and an AddRule override whose rule
identifier already exists in its target concept is BODU-CAL-DUP-RULE under every value. Overrides apply to
the concept the policy keeps.
A value that settles duplicates reports nothing. A binary pack is written from a loaded resource, whose duplicates the policy has already settled, so the policy needs no pack format version of its own.
// Keep the first declaration of a concept or rule identifier and discard the later ones.
NotableDateDocumentBuilder.Create("demo")
.WithResolutionPolicy(p => p.WithDuplicatePolicy(DuplicatePolicy.KeepFirst));
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |