Skip to content

Commit 7fc3718

Browse files
Merge pull request #217836 from ealsur/users/ealsur/accesscondition
Cosmos SDK migration doc updates
2 parents d51d5bb + d385bf2 commit 7fc3718

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

articles/cosmos-db/nosql/migrate-dotnet-v3.md

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: esarroyo
66
ms.service: cosmos-db
77
ms.subservice: nosql
88
ms.topic: how-to
9-
ms.date: 06/01/2022
9+
ms.date: 11/09/2022
1010
ms.devlang: csharp
1111
---
1212

@@ -84,11 +84,7 @@ The following classes have been replaced on the 3.0 SDK:
8484

8585
* `Microsoft.Azure.Documents.UriFactory`
8686

87-
* `Microsoft.Azure.Documents.Document`
88-
89-
* `Microsoft.Azure.Documents.Resource`
90-
91-
The Microsoft.Azure.Documents.UriFactory class has been replaced by the fluent design.
87+
The Microsoft.Azure.Documents.UriFactory class has been replaced by the fluent design.
9288

9389
# [.NET SDK v3](#tab/dotnet-v3)
9490

@@ -112,8 +108,18 @@ await client.CreateDocumentAsync(
112108

113109
---
114110

111+
* `Microsoft.Azure.Documents.Document`
112+
115113
Because the .NET v3 SDK allows users to configure a custom serialization engine, there's no direct replacement for the `Document` type. When using Newtonsoft.Json (default serialization engine), `JObject` can be used to achieve the same functionality. When using a different serialization engine, you can use its base json document type (for example, `JsonDocument` for System.Text.Json). The recommendation is to use a C# type that reflects the schema of your items instead of relying on generic types.
116114

115+
* `Microsoft.Azure.Documents.Resource`
116+
117+
There is no direct replacement for `Resource`, in cases where it was used for documents, follow the guidance for `Document`.
118+
119+
* `Microsoft.Azure.Documents.AccessCondition`
120+
121+
`IfNoneMatch` or `IfMatch` are now available on the `Microsoft.Azure.Cosmos.ItemRequestOptions` directly.
122+
117123
### Changes to item ID generation
118124

119125
Item ID is no longer auto populated in the .NET v3 SDK. Therefore, the Item ID must specifically include a generated ID. View the following example:
@@ -125,31 +131,22 @@ public Guid Id { get; set; }
125131

126132
### Changed default behavior for connection mode
127133

128-
The SDK v3 now defaults to Direct + TCP connection modes compared to the previous v2 SDK, which defaulted to Gateway + HTTPS connections modes. This change provides enhanced performance and scalability.
134+
The SDK v3 now defaults to [Direct + TCP connection modes](sdk-connection-modes.md) compared to the previous v2 SDK, which defaulted to Gateway + HTTPS connections modes. This change provides enhanced performance and scalability.
129135

130136
### Changes to FeedOptions (QueryRequestOptions in v3.0 SDK)
131137

132138
The `FeedOptions` class in SDK v2 has now been renamed to `QueryRequestOptions` in the SDK v3 and within the class, several properties have had changes in name and/or default value or been removed completely.
133139

134-
`FeedOptions.MaxDegreeOfParallelism` has been renamed to `QueryRequestOptions.MaxConcurrency` and default value and associated behavior remains the same, operations run client side during parallel query execution will be executed serially with no-parallelism.
135-
136-
`FeedOptions.EnableCrossPartitionQuery` has been removed and the default behavior in SDK 3.0 is that cross-partition queries will be executed without the need to enable the property specifically.
137-
138-
`FeedOptions.PopulateQueryMetrics` is enabled by default with the results being present in the `FeedResponse.Diagnostics` property of the response.
139-
140-
`FeedOptions.RequestContinuation` has now been promoted to the query methods themselves.
141-
142-
The following properties have been removed:
143-
144-
* `FeedOptions.DisableRUPerMinuteUsage`
145-
146-
* `FeedOptions.EnableCrossPartitionQuery`
147-
148-
* `FeedOptions.JsonSerializerSettings`
149-
150-
* `FeedOptions.PartitionKeyRangeId`
151-
152-
* `FeedOptions.PopulateQueryMetrics`
140+
| .NET v2 SDK | .NET v3 SDK |
141+
|-------------|-------------|
142+
|`FeedOptions.MaxDegreeOfParallelism`|`QueryRequestOptions.MaxConcurrency` - Default value and associated behavior remains the same, operations run client side during parallel query execution will be executed serially with no-parallelism.|
143+
|`FeedOptions.PartitionKey`|`QueryRequestOptions.PartitionKey` - Behavior maintained. |
144+
|`FeedOptions.EnableCrossPartitionQuery`|Removed. Default behavior in SDK 3.0 is that cross-partition queries will be executed without the need to enable the property specifically. |
145+
|`FeedOptions.PopulateQueryMetrics`|Removed. It is now enabled by default and part of the [diagnostics](troubleshoot-dotnet-sdk.md#capture-diagnostics).|
146+
|`FeedOptions.RequestContinuation`|Removed. It is now promoted to the query methods themselves. |
147+
|`FeedOptions.JsonSerializerSettings`|Removed. Serialization can be customized through a [custom serializer](/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions.serializer) or [serializer options](/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions.serializeroptions).|
148+
|`FeedOptions.PartitionKeyRangeId`|Removed. Same outcome can be obtained from using [FeedRange](change-feed-pull-model.md#using-feedrange-for-parallelization) as input to the query method.|
149+
|`FeedOptions.DisableRUPerMinuteUsage`|Removed.|
153150

154151
### Constructing a client
155152

@@ -213,7 +210,7 @@ catch (CosmosException cosmosException) {
213210

214211
### ConnectionPolicy
215212

216-
Some settings in `ConnectionPolicy` have been renamed or replaced:
213+
Some settings in `ConnectionPolicy` have been renamed or replaced by `CosmosClientOptions`:
217214

218215
| .NET v2 SDK | .NET v3 SDK |
219216
|-------------|-------------|

0 commit comments

Comments
 (0)