Last active
January 6, 2020 13:22
-
-
Save scattered-code/e138bdd8805b9d255c981c7a13c3d21a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static async IAsyncEnumerable<Order> GetDocumentsFromDatabase2(IAsyncDocumentSession session) | |
{ | |
var skip = 0; | |
do | |
{ | |
var entries = await session.Query<Order>().OrderByDescending(x => x.Id).Skip(skip).Take(100).ToListAsync(); | |
foreach (var entry in entries) | |
yield return entry; | |
skip += 100; | |
if (entries.Count < 100) | |
break; | |
} while (true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment