Class ContactBookScope
- Namespace
- MailFathom.Application.Contacts
- Assembly
- MailFathom.Application.dll
The books one user reads: their own, and the collected book of every mail account they are assigned.
public sealed record ContactBookScope : IEquatable<ContactBookScope>
- Inheritance
-
ContactBookScope
- Implements
- Inherited Members
Remarks
A read of "the contact book" is a read of several, because what a person knows about their correspondents is partly what they wrote down and partly what their mailboxes picked up. This states which books those are and, just as importantly, in what order — because two books may hold one address and only one of the two records is shown.
The order is the user's own book first, then the accounts by the ordinal order of their identifiers. A record the user wrote therefore wins over anything a mailbox collected for the same address, which is the point of writing one down: their name and their note are what they see. An address two of their mailboxes both collected is answered from the first of the two in that order, so the answer is the same on every read rather than whichever row the database returned first — and it is the same for two users of one mailbox, because the order is the accounts' own rather than the order either user's record happened to declare them in.
The order is carried as Keys rather than recomputed per read, because the store answers the precedence question with it: a record is hidden when one of its addresses is held in a book that comes before its own.
Properties
- Books
Gets every book this scope reads, the user's own first and the accounts' after it in precedence order.
- OwnBook
Gets the user's own book, which every write a caller makes goes into.
- User
Gets the user whose reading this scope describes.
Methods
- Of(UserId, IReadOnlyList<MailAccountId>)
Describes a user reading their own book and the collected books of the accounts they are assigned.
- OfOwnBookAlone(UserId)
Describes a read of one user's own book alone, reaching nothing any mailbox collected.