Created
September 1, 2017 16:08
-
-
Save dontpaniclabsgists/307436cf9ce0ca27774255bd11fe5d25 to your computer and use it in GitHub Desktop.
cosmos4_2
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[]> AllInPartition(string customerId) | |
{ | |
using (var client = new DocumentClient(new Uri(_endpoint), _key)) | |
{ | |
var link = UriFactory.CreateDocumentCollectionUri(_databaseId, CollectionId); | |
var query = client.CreateDocumentQuery<Note>( | |
link, | |
new FeedOptions() | |
{ | |
PartitionKey = new Microsoft.Azure.Documents.PartitionKey(customerId) | |
}) | |
.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