Method ReadMessageCountsAsync
- Namespace
- MailFathom.Application.Emails.Threads
- Assembly
- MailFathom.Application.dll
ReadMessageCountsAsync(IReadOnlyList<EmailThreadId>, MailboxScope, CancellationToken)
Counts how many messages the caller may see in each of the named conversations.
Task<IReadOnlyDictionary<EmailThreadId, int>> ReadMessageCountsAsync(IReadOnlyList<EmailThreadId> threadIds, MailboxScope scope, CancellationToken cancellationToken)
Parameters
threadIdsIReadOnlyList<EmailThreadId>The conversations to count, as the rows of one page named them.
scopeMailboxScopeThe accounts and folders configuration admits, which the query is narrowed by.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task<IReadOnlyDictionary<EmailThreadId, int>>
The number of messages in each conversation that holds any, keyed by identifier. A conversation the scope admits nothing of is absent rather than present as zero.
Remarks
One query for the whole page rather than one per row, which is the same arrangement the preview and the enrichment of a page are read under: a list of fifty rows costs one count instead of fifty.
It counts by membership and applies no bound, unlike the assembly above. A count is what a row draws to say the message stands for an exchange rather than a single message, so cutting it at MaximumAssembledEmails would report a long conversation as shorter than it is — and counting is what a database does without carrying any of the rows.
No merge is followed, because none has to be: a merge repoints every message of the folded conversation at the survivor, and the identifiers handed here are the ones the counted rows carry.
Exceptions
- ArgumentNullException
Thrown when
threadIdsorscopeis null.