|
3 | 3 | using System.Threading.Tasks;
|
4 | 4 | using Microsoft.AspNetCore.Http;
|
5 | 5 | using Microsoft.AspNetCore.Mvc;
|
6 |
| -using Microsoft.Azure.Documents; |
7 |
| -using Microsoft.Azure.Documents.Client; |
8 |
| -using Microsoft.Azure.Documents.Linq; |
| 6 | +using Microsoft.Azure.Cosmos; |
9 | 7 | using Microsoft.Azure.WebJobs;
|
10 | 8 | using Microsoft.Azure.WebJobs.Extensions.Http;
|
11 | 9 | using Microsoft.Extensions.Configuration;
|
@@ -37,17 +35,11 @@ public async Task<IActionResult> Run(
|
37 | 35 | builder.TryGetValue("AccountEndpoint", out object dbUri);
|
38 | 36 | builder.TryGetValue("AccountKey", out object dbKey);
|
39 | 37 |
|
40 |
| - var client = new DocumentClient(new Uri(dbUri.ToString()), dbKey.ToString()); |
41 |
| - Uri collUri = UriFactory.CreateDocumentCollectionUri("ItemDb", "ItemCollection"); |
| 38 | + var client = new CosmosClient(dbUri.ToString(), dbKey.ToString()); |
42 | 39 |
|
43 |
| - var options = new FeedOptions |
44 |
| - { |
45 |
| - EnableCrossPartitionQuery = true |
46 |
| - }; |
47 |
| - |
48 |
| - IDocumentQuery<Document> documentQuery = client.CreateDocumentQuery<Document>(collUri, "SELECT * FROM c WHERE STARTSWITH(c.id, @PartitionLeasePrefix)", options).AsDocumentQuery<Document>(); |
49 |
| - |
50 |
| - await documentQuery.ExecuteNextAsync(); |
| 40 | + Container container = client.GetDatabase("ItemDb").GetContainer("ItemCollection"); |
| 41 | + FeedIterator iterator = container.GetItemQueryStreamIterator("SELECT * FROM c"); |
| 42 | + await iterator.ReadNextAsync(); |
51 | 43 | }
|
52 | 44 | catch (Exception ex)
|
53 | 45 | {
|
|
0 commit comments