Method SaveMailDraftContentAsync
- Namespace
- MailFathom.Application.EmailContent.Storage
- Assembly
- MailFathom.Application.dll
SaveMailDraftContentAsync(IPersistenceSession, MailDraftId, PlacedEmailContent, CancellationToken)
Saves the raw MIME one revision of a draft is held as, replacing whatever the previous revision stored.
Task SaveMailDraftContentAsync(IPersistenceSession session, MailDraftId draftId, PlacedEmailContent placedContent, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe explicit persistence session this content write participates in.
draftIdMailDraftIdThe draft this message is the current revision of.
placedContentPlacedEmailContentWhat PlaceContentAsync(EmailContentKind, ReadOnlyMemory<byte>, CancellationToken) answered for this payload.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task
A task that completes after durable storage.
Remarks
This is the one raw-MIME write in this system that overwrites, and the difference from the outgoing one is the whole reason a draft is not an outgoing record. A send's payload is written once because a retry has to transmit the bytes an earlier attempt may already have begun transmitting; a draft's payload is what its author is still editing, and holding every version of it would keep a message per keystroke for as long as the draft lives.
It joins the caller's session because the payload and the revision it belongs to are one decision: a draft whose row says revision three and whose bytes are revision two is a draft that would be appended wrongly and promoted wrongly, so the two commit together or neither does.
Exceptions
- ArgumentNullException
Thrown when
sessionorplacedContentis null.- InvalidOperationException
Thrown when no draft is held under
draftId.