Method Restore
- Namespace
- MailFathom.Domain.Notifications
- Assembly
- MailFathom.Domain.dll
Restore(NotificationId, UserId, NotificationKind, string, string, NotificationStatement?, string?, NotificationTarget, NotificationDeduplicationKey, DateTimeOffset, bool)
Restores a notification this deployment already kept, with the read state it was stored under.
public static Notification Restore(NotificationId id, UserId user, NotificationKind kind, string title, string body, NotificationStatement? statement, string? source, NotificationTarget target, NotificationDeduplicationKey deduplicationKey, DateTimeOffset occurredAt, bool isRead)
Parameters
idNotificationIdWhat addresses the notification.
userUserIdThe user it happened to.
kindNotificationKindWhat part of MailFathom it is about.
titlestringThe headline the row is drawn with.
bodystringThe second line the row is drawn with.
statementNotificationStatementWhat the notification says as a condition and its numbers, or null where the row names no condition.
sourcestringWhat the source line names beyond the kind, or null where the kind is the whole of it.
targetNotificationTargetWhere opening it leads.
deduplicationKeyNotificationDeduplicationKeyThe condition it was raised for.
occurredAtDateTimeOffsetWhen the thing it describes happened.
isReadboolWhether the person has read it.
Returns
- Notification
The notification as it stands.
Remarks
It validates exactly what Compose(NotificationId, UserId, NotificationKind, string, string, NotificationStatement?, string?, NotificationTarget, NotificationDeduplicationKey, DateTimeOffset) validates rather than trusting the store, because a row read back is input from outside this process however it got there: a hand-edited table and a migration that widened a column reach a reader the same way a producer does. The one thing it takes that composing does not is the read state, which is the store's to say and never a producer's.
Exceptions
- ArgumentNullException
Thrown when
targetis null.- ArgumentException
Thrown when
titleorbodyis blank, whensourceis present and blank, whenusernames nobody, or whenidordeduplicationKeyis the struct default.- ArgumentOutOfRangeException
Thrown when
kindis not a declared kind, or when a text exceeds the bound stated for it.