Method SaveAsync
- Namespace
- MailFathom.Application.Spam
- Assembly
- MailFathom.Application.dll
SaveAsync(IPersistenceSession, SpamClassification, CancellationToken)
Stages the classification of one occurrence, replacing whatever was recorded for it.
Task SaveAsync(IPersistenceSession session, SpamClassification classification, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe explicit persistence session this write participates in.
classificationSpamClassificationWhat to record.
cancellationTokenCancellationTokenCancels the lookup before anything is staged.
Returns
- Task
A task that completes once the write is staged in the caller's session.
Remarks
Staged rather than committed, so the record and the signals it rests on reach the database as one unit. Replacing an existing record replaces its signals with it: a classification is what is believed now, and keeping the signals of a superseded verdict beside the new ones would leave a record nobody could read.
Exceptions
- ArgumentNullException
Thrown when
classificationis null.