Created
August 24, 2017 18:16
-
-
Save dontpaniclabsgists/e99ea2f6122caa6e6f6df17952b7d193 to your computer and use it in GitHub Desktop.
cosmos3_3
This file contains hidden or 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
public async Task<Note[]> All() | |
{ | |
using (var client = new DocumentClient(new Uri(_endpoint), _key)) | |
{ | |
var link = UriFactory.CreateDocumentCollectionUri(_databaseId, CollectionId); | |
var query = client.CreateDocumentQuery<Note>( | |
link, | |
new FeedOptions() | |
{ | |
EnableCrossPartitionQuery = true | |
}) | |
.AsDocumentQuery(); | |
var results = new List<Note>(); | |
while (query.HasMoreResults) | |
{ | |
results.AddRange(await query.ExecuteNextAsync<Note>()); | |
} | |
return results.OrderBy(x => x.Id).ToArray(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment