From 169a26990c10561e6c5e83bf7475e270e535872c Mon Sep 17 00:00:00 2001 From: Jacob Viau Date: Wed, 8 May 2024 10:48:41 -0700 Subject: [PATCH] Update CosmosDB package used in tests (#10127) --- .../NativeDependencyNoRuntimes.cs | 18 +++++------------- .../NativeDependencyNoRuntimes.csproj | 2 +- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/test/CSharpPrecompiledTestProjects/NativeDependencyNoRuntimes/NativeDependencyNoRuntimes.cs b/test/CSharpPrecompiledTestProjects/NativeDependencyNoRuntimes/NativeDependencyNoRuntimes.cs index bb467a5cf7..c7b57792e6 100644 --- a/test/CSharpPrecompiledTestProjects/NativeDependencyNoRuntimes/NativeDependencyNoRuntimes.cs +++ b/test/CSharpPrecompiledTestProjects/NativeDependencyNoRuntimes/NativeDependencyNoRuntimes.cs @@ -3,9 +3,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.Azure.Documents; -using Microsoft.Azure.Documents.Client; -using Microsoft.Azure.Documents.Linq; +using Microsoft.Azure.Cosmos; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.Extensions.Configuration; @@ -37,17 +35,11 @@ public async Task Run( builder.TryGetValue("AccountEndpoint", out object dbUri); builder.TryGetValue("AccountKey", out object dbKey); - var client = new DocumentClient(new Uri(dbUri.ToString()), dbKey.ToString()); - Uri collUri = UriFactory.CreateDocumentCollectionUri("ItemDb", "ItemCollection"); + var client = new CosmosClient(dbUri.ToString(), dbKey.ToString()); - var options = new FeedOptions - { - EnableCrossPartitionQuery = true - }; - - IDocumentQuery documentQuery = client.CreateDocumentQuery(collUri, "SELECT * FROM c WHERE STARTSWITH(c.id, @PartitionLeasePrefix)", options).AsDocumentQuery(); - - await documentQuery.ExecuteNextAsync(); + Container container = client.GetDatabase("ItemDb").GetContainer("ItemCollection"); + FeedIterator iterator = container.GetItemQueryStreamIterator("SELECT * FROM c"); + await iterator.ReadNextAsync(); } catch (Exception ex) { diff --git a/test/CSharpPrecompiledTestProjects/NativeDependencyNoRuntimes/NativeDependencyNoRuntimes.csproj b/test/CSharpPrecompiledTestProjects/NativeDependencyNoRuntimes/NativeDependencyNoRuntimes.csproj index 8a9ef95ede..4218cc35ec 100644 --- a/test/CSharpPrecompiledTestProjects/NativeDependencyNoRuntimes/NativeDependencyNoRuntimes.csproj +++ b/test/CSharpPrecompiledTestProjects/NativeDependencyNoRuntimes/NativeDependencyNoRuntimes.csproj @@ -5,7 +5,7 @@ - +