Skip to content

Commit 169a269

Browse files
authored
Update CosmosDB package used in tests (#10127)
1 parent 03ab073 commit 169a269

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

test/CSharpPrecompiledTestProjects/NativeDependencyNoRuntimes/NativeDependencyNoRuntimes.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
using System.Threading.Tasks;
44
using Microsoft.AspNetCore.Http;
55
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;
97
using Microsoft.Azure.WebJobs;
108
using Microsoft.Azure.WebJobs.Extensions.Http;
119
using Microsoft.Extensions.Configuration;
@@ -37,17 +35,11 @@ public async Task<IActionResult> Run(
3735
builder.TryGetValue("AccountEndpoint", out object dbUri);
3836
builder.TryGetValue("AccountKey", out object dbKey);
3937

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());
4239

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();
5143
}
5244
catch (Exception ex)
5345
{

test/CSharpPrecompiledTestProjects/NativeDependencyNoRuntimes/NativeDependencyNoRuntimes.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66
<ItemGroup>
77
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.3.0" />
8-
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.22.0" />
8+
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.39.1" />
99
</ItemGroup>
1010
<ItemGroup>
1111
<None Update="host.json">

0 commit comments

Comments
 (0)