Method ReplaceAsync
- Namespace
- MailFathom.Application.Contacts
- Assembly
- MailFathom.Application.dll
ReplaceAsync(IPersistenceSession, ContactBookHolder, Contact, CancellationToken)
Stages the held record being replaced by the one supplied, address rows included.
Task<bool> ReplaceAsync(IPersistenceSession session, ContactBookHolder holder, Contact contact, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe session the write joins.
holderContactBookHolderThe book holding the record being replaced.
contactContactThe contact as it is to stand, identified by its own identity.
cancellationTokenCancellationTokenCancels the staging.
Returns
- Task<bool>
true when that book held the contact and the replacement was staged; false when it holds none.
Remarks
An address the record no longer names is removed rather than left behind, which is what makes a replacement the whole record instead of an addition to it. Two amendments of one contact are last-writer-wins, which is what an amendment stating the whole record means: the later one is the record. What is not left to that is a contact erased while an amendment was in flight — the row's concurrency token turns that into a conflict, so the retry reads a book holding nobody and answers so instead of putting the person back.
Exceptions
- ArgumentNullException
Thrown when a required argument is null.
- ArgumentException
Thrown when the session cannot supply this store's persistence context.