Method Create
- Namespace
- MailFathom.Domain.Calendar
- Assembly
- MailFathom.Domain.dll
Create(CalendarEventId, CalendarEventTitle, DateTimeOffset, DateTimeOffset?, bool, IReadOnlyCollection<Reminder>, CalendarEventOrigin, StoredEmailId?, ImportedCalendarEventUid?, DateTimeOffset, DateTimeOffset)
Builds an event from what a writer supplied, enforcing every invariant the calendar rests on.
public static CalendarEvent Create(CalendarEventId id, CalendarEventTitle title, DateTimeOffset start, DateTimeOffset? end, bool isAllDay, IReadOnlyCollection<Reminder> reminders, CalendarEventOrigin origin, StoredEmailId? sourceMessage, ImportedCalendarEventUid? importedUid, DateTimeOffset recordedAt, DateTimeOffset amendedAt)
Parameters
idCalendarEventIdThe identity this event keeps for as long as it is held.
titleCalendarEventTitleWhat the event is called.
startDateTimeOffsetWhen it begins.
endDateTimeOffset?When it ends, or null when nothing said how long it lasts.
isAllDayboolWhether the event is stated as a day rather than as a clock time.
remindersIReadOnlyCollection<Reminder>The leads it is to be announced at, in any order and without repetition, or empty to announce nothing.
originCalendarEventOriginWhether it is on the calendar or offered to it.
sourceMessageStoredEmailId?The message it came out of, or null when no message named it.
importedUidImportedCalendarEventUid?The identifier the file it came from named it by, or null when none did.
recordedAtDateTimeOffsetWhen it was written here.
amendedAtDateTimeOffsetWhen it was last amended, which is
recordedAtfor a new event.
Returns
- CalendarEvent
The event.
Remarks
An end at the same instant as the start is refused rather than kept as an event of no length: an entry naming both is naming a span, and one whose span is empty is a file or a reading that went wrong rather than something to draw. An event that genuinely has no length states no end at all.
Exceptions
- ArgumentNullException
Thrown when
remindersis null.- ArgumentOutOfRangeException
Thrown when
originnames no declared value, whenendis not afterstart, or when more than MaximumCount reminders are supplied.- ArgumentException
Thrown when
id,title, or a suppliedimportedUidis the default of its type, when a proposal is supplied withimportedUid, or when one lead is supplied twice.