Interface IContactStore
- Namespace
- MailFathom.Application.Contacts
- Assembly
- MailFathom.Application.dll
Keeps the contact book's records, and erases one completely when an owner asks.
public interface IContactStore
Remarks
The two staging operations write through the caller's session and commit nothing, as ADR 0001 requires of a write port: the caller decides the transaction, and the retry policy above it decides what a lost race means. Which addresses one contact may hold is the domain's rule; which contact may hold an address is this store's, enforced by a unique constraint rather than by a check before the insert, because two callers claiming one address pass any such check.
Erasure joins a session for the same reason the other two do, and for one of its own: what it reports having removed and what it removed are read in one transaction, so the count is a fact rather than a number that was true a moment earlier. The rows derived from a contact go with it through the schema's own cascade rather than through a second statement somebody remembers to write. It is the data-subject erasure path, so it removes rather than marks.
Methods
- AddAsync(IPersistenceSession, Contact, CancellationToken)
Stages a contact the book does not yet hold.
- EraseAsync(IPersistenceSession, ContactId, CancellationToken)
Erases one contact and everything derived from it.
- EraseCollectedAsync(IPersistenceSession, CancellationToken)
Erases every contact of the collected origin, and everything derived from them.
- ReplaceAsync(IPersistenceSession, Contact, CancellationToken)
Stages the held record being replaced by the one supplied, address rows included.