I may be missing something obvious here but... I'm trying to use DocumentClient.UpsertDocumentAsync(...) to upsert into CosmosDB. Problem is, I can't create a DocumentClient because it is marked as an "internal class". All the examples I've seen thus far point to this as the way to do it.
For instance:
var docClient = new Microsoft.Azure.Cosmos.DocumentClient(
new Uri("..."),
"...",
null,
null);
This yields the IDE error "Cannot access internal class 'DocumentClient' here", because, well, it is an internal class. Did this change with the latest version maybe?
Here is the decompiled signature:
namespace Microsoft.Azure.Cosmos
{
...
internal partial class DocumentClient : IDisposable,
IAuthorizationTokenProvider,
ICosmosAuthorizationTokenProvider,
IDocumentClient,
IDocumentClientInternal
...
I'm using the latest Nuget package (v.3.27.0 published 5/6/2022) of Microsoft.Azure.Cosmos
CodePudding user response:
You do not need to access the DocumentClient
, that's an internal class. It is not used by any public surface operation and you do not need it to interact with the V3 SDK.
Please see the official examples: https://docs.microsoft.com/azure/cosmos-db/sql/sql-api-dotnet-v3sdk-samples#item-examples
If you are migrating from a V2 SDK to V3, please see the migration guide: https://docs.microsoft.com/azure/cosmos-db/sql/migrate-dotnet-v3