Skip to main content

Session: Querying: StreamFileHeadersAsync

#Session: Querying: StreamFileHeadersAsync

File Header can be streamed With StreamFileHeadersAsync method from Advanced session operations .

Syntax

Task<IAsyncEnumerator<FileHeader>> StreamFileHeadersAsync(Etag fromEtag, int pageSize = int.MaxValue);
Parameters
fromEtagEtagETag of a file from which stream should start
pageSizeintMaximum number of file headers that will be retrieved

Return Value
Task<IAsyncEnumerator<FileHeader>>A task that represents the asynchronous operation. The task result is the enumerator of FileHeaders objects.

Example

var allFilesMatchingCriteria = new List<FileHeader>();

using (var reader = await session.Advanced.StreamFileHeadersAsync(fromEtag: fromEtag, pageSize: 10))
{
while (await reader.MoveNextAsync())
{
allFilesMatchingCriteria.Add(reader.Current);
}
}

Entities loaded using Stream will be transient (not attached to session).