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() | |
| { |
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
| var link = UriFactory.CreateDocumentUri(_databaseId, CollectionId, id); |
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
| var note = await client.ReadDocumentAsync<Note>(link, | |
| new RequestOptions() | |
| { | |
| PartitionKey = new Microsoft.Azure.Documents.PartitionKey(customerId) | |
| }); |
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> ReadOne(string id, string customerId) | |
| { | |
| using (var client = new DocumentClient(new Uri(_endpoint), _key)) | |
| { | |
| var link = UriFactory.CreateDocumentUri(_databaseId, CollectionId, id); | |
| var note = await client.ReadDocumentAsync<Note>(link, | |
| new RequestOptions() | |
| { | |
| PartitionKey = new Microsoft.Azure.Documents.PartitionKey(customerId) | |
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<int> Count() | |
| { | |
| return (await All()).Length; | |
| } |
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<int> Count() | |
| { | |
| using (var client = new DocumentClient(new Uri(_endpoint), _key)) | |
| { | |
| var link = UriFactory.CreateDocumentCollectionUri(_databaseId, CollectionId); | |
| var count = client.CreateDocumentQuery<Note>( | |
| link, | |
| new FeedOptions() | |
| { |
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<PageResult> Page(string token, int pageSize, string customerId) | |
| { | |
| using (var client = new DocumentClient(new Uri(_endpoint), _key)) | |
| { | |
| var link = UriFactory.CreateDocumentCollectionUri(_databaseId, CollectionId); | |
| var querySetup = client.CreateDocumentQuery<Note>( | |
| link, | |
| new FeedOptions() | |
| { |
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
| string token = null; | |
| while (true) | |
| { | |
| var result = await accessor.Page(token, 2, customerId); | |
| if (result.Notes.Length > 0) | |
| { | |
| var text = JsonConvert.SerializeObject(result.Notes); | |
| token = result.Token; | |
| Console.WriteLine("PAGE: " + text); | |
| } |
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
| class Note | |
| { | |
| [JsonProperty(PropertyName = "id")] | |
| public string Id { get; set; } | |
| [JsonProperty(PropertyName = "customerid")] | |
| public string CustomerId { get; set; } | |
| [JsonProperty(PropertyName = "text")] | |
| public string Text { get; set; } |
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() | |
| { |
OlderNewer