Construct a DateRange¶
Construct a DateRange from various inputs with sentinel defaulting, triggered when caller creates a range.
| Field | Value |
|---|---|
| Operation ID | OP-014 |
| Trigger | Caller creates a range |
| Inputs | none / IDateRange / DateTime / DateTime, DateTime |
| Outputs | DateRange instance |
| Primary components | DateRange` constructors (4 overloads) and `DateRange.Empty |
| Entry point | Common/SAIF.Common/Classes/DateRange.cs |
Steps¶
- Parameterless ctor: set
BeginDate = DateTime.MinValue,EndDate = DateTime.MaxValue— the canonical unbounded range. (BR-002, BR-032) - Copy ctor: copy
BeginDate/EndDatefrom the suppliedIDateRange(no null guard). - Begin-only ctor: set the supplied begin date and default
EndDatetoDateTime.MaxValue(open-ended forward). (BR-032) - Two-date ctor: assign both, then coerce
EndDatetoDateTime.MaxValuewhen the caller passedDateTime.MinValue— a MinValue end means "no end date". (BR-033) DateRange.Emptyis a cached static parameterless-constructed instance (MinValue..MaxValue). (BR-032)
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start(["Caller constructs<br>a DateRange"]) --> S1["Parameterless ctor: BeginDate=MinValue,<br>EndDate=MaxValue"]
S1 --> S2["Copy ctor: copy BeginDate/EndDate<br>from supplied IDateRange"]
S2 --> S3["Begin-only ctor: set begin date,<br>default EndDate to MaxValue"]
S3 --> D1{"Two-date ctor: EndDate<br>supplied as MinValue?"}
D1 -->|Yes| S4a["Coerce EndDate<br>to MaxValue"]
D1 -->|No| S4b["Assign both dates<br>as supplied"]
S4a --> S5
S4b --> S5["DateRange.Empty: cached<br>static instance (MinValue..MaxValue)"]
S5 --> End([Return DateRange instance])
Related documentation¶
Sources¶
Common/SAIF.Common/Classes/DateRange.cs