How to update DocumentDb from Microsoft.Azure.DocumentDB.Core

2020-09-24T09:20:47.14+00:00

Hello,

As we are updating our code base from netcoreapp3.1 to net5.0, one of the thing we have to do is update the Azure SDK we are using (KeyVault / Blob / Cosmos / ...)
This question is about the CosmosDb part as we are consuming is with DocumentDb using SQL query

As of today we use Microsoft.Azure.DocumentDB.Core
The nuget page https://www.nuget.org/packages/Microsoft.Azure.DocumentDB.Core indicate that the documentation is here : https://azure.microsoft.com/en-us/services/cosmos-db/#documentation
28012-image.png
The first link point to this page : https://learn.microsoft.com/en-us/azure/cosmos-db/sql-api-get-started#SetupVS which indicate to use the nuget Microsoft.Azure.Cosmos

The Azure Sdk team effort seems to rename everything from Microsoft.Azure.Foo to Azure.Foo so I'm not very about that one, also I see this :
28033-image.png

So the docs on the left point to the v4 SDK which seems to be the "target", and has been renamed to Azure.Cosmos
Though when I try to reference this one, I'm not sure yet where to find the replacement for few piece of code by reading the "release note"

Here is a very small example of one portion of the code I'm not sure how to udpate :

https://gist.github.com/tebeco/59d208ee46fe3f788251103fc4e4a73d

I suppose I'll be able to re-write everything using this page :
https://learn.microsoft.com/en-us/azure/cosmos-db/create-sql-api-dotnet-v4#query-the-items

I suppose the various link are not up to date yet and point to v2 or v3 ?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
917 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anurag Sharma 17,261 Reputation points
    2020-09-25T07:12:15.233+00:00

    Hi @HERTOGS Alexandre (EXT) GbsuCldDit , welcome to Microsoft Q&A forum.

    Thanks for providing such a detailed analysis an yes you are correct in mentioning that some code piece could still be corrected with respect to v4 and as there is lot of documentation available already, the internal team keeps on updating them as and when we notice or someone points out.

    The link provided above is a good start if you want to rewrite code and has a very clear and detailed description of implementing basic code scenarios. If you face any trouble with them, we would be delighted to help you out on the same. Below are some more article you can refer to, you can start with Main method.

    1. https://learn.microsoft.com/en-us/azure/cosmos-db/create-sql-api-dotnet-v4
    2. https://github.com/Azure-Samples/cosmos-dotnet-v4-getting-started

    Again, we appreciate your efforts for feedback.