Alfiya
Alfiya

Reputation: 11

Migration from Microsoft.Azure.DocumentDB to Microsoft.Azure.Cosmos package while current class library is in .NET 4.7.2

My current project class library running on .NET 4.7.2, and we are using Microsoft.Azure.DocumentDB package. We have to update to version 3 of Azure.

Questions:

  1. Will we be able to do update to Microsoft.Azure.Cosmos package with class library in .NET 4.7, or is Microsoft.Azure.Cosmos package only supported on .NET Standard ?
  2. If Yes, then while migrating code we are getting "Inaccessible due to protection level error" in number of places.
  3. If No, then do we need to change class library from .NET 4.7 to .NET Standard to migrate our code?

Upvotes: 1

Views: 503

Answers (1)

Matias Quaranta
Matias Quaranta

Reputation: 15603

Microsoft.Azure.Cosmos is a NET Standard 2.0 library, NET Standard is an interface that defines a series of APIs that are implemented by different frameworks: https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0

.NET Framework 4.7.2 is a framework implementation, compatible with NET Standard 2.0:

NET Standard table showing the different framework implementations compatible with 2.0

So the answer is, you can use Microsoft.Azure.Cosmos on a .NET 4.7.2 application without issues.

For migration from Microsoft.Azure.DocumentDB to Microsoft.Azure.Cosmos see: https://learn.microsoft.com/azure/cosmos-db/sql/migrate-dotnet-v3

The "Inaccessible due to protection level error" errors you are getting are probably due to your code still referencing APIs or types from Microsoft.Azure.DocumentDB. These are two different Major Version libraries, so your application code needs to change due to the breaking changes.

Upvotes: 2

Related Questions