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

Amol Jagdale (INFOSYS LIMITED) 1 Reputation point Microsoft External Staff
2022-07-14T18:41:35.623+00:00

My current project class library is in .Net Framework 4.7.2 (target framework) and we are using Microsoft.Azure.DocumentDB package. we have to update to version 3 of Azure cosmos db. due to that we are uninstalling Microsoft.Azure.DocumentDB package and installing Microsoft.Azure.Cosmos package.

Questions

  1. Does we will be able to do update into Microsoft.Azure.Cosmos package with class library in .Net Framework 4.7 or Microsoft.Azure.Cosmos package only supporting ".Net standard" framework ?
    2)If Yes, then while migrating code we are getting "Inaccessible due to protection level error" in number of places.
    3)If No, then does we need to change class libaray from .Net framework 4.7 to .Net Standard to migrate code ?
Azure Migrate
Azure Migrate
A central hub of Azure cloud migration services and tools to discover, assess, and migrate workloads to the cloud.
925 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,901 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mark Brown - MSFT 2,771 Reputation points Microsoft Employee
    2022-07-14T20:07:22.217+00:00

    You can continue to target .NET Framework 4.7. You only need include .NET Standard in your project. See this passage below from our article, Migrate your application to use the Azure Cosmos DB .NET SDK v3

    The SDK targets .NET Standard 2.0 that unifies the existing Azure Cosmos DB .NET Framework and .NET Core SDKs into a single .NET SDK. You can use the .NET SDK in any platform that implements .NET Standard 2.0, including your .NET Framework 4.6.1+ and .NET Core 2.0+ applications.

    I can't say why you are experiencing access errors. I would check the modifiers on your classes and variables, more details here


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.