尝试插入 CosmosDb 时出现以下错误。正在插入文档但抛出此错误。我正在使用 .net core 5.0、Microsoft.Azure.Cosmos 3.17.0。请指教。
找不到方法:'System.Threading.Tasks.Task 1<Microsoft.Azure.Cosmos.Serialization.HybridRow.Result> Microsoft.Azure.Cosmos.Serialization.HybridRow.RecordIO.RecordIOStream.ReadRecordIOAsync(System.IO.Stream, System.Func
2<System.ReadOnlyMemory 1<Byte>,Microsoft.Azure.Cosmos.Serialization.HybridRow.Result>, System.Func
2<System.ReadOnlyMemory 1<Byte>,Microsoft.Azure.Cosmos.Serialization.HybridRow.Result>, Microsoft.Azure.Cosmos.Serialization.HybridRow.MemorySpanResizer
1)'
protected virtual CosmosClient _cosmosClient
{
get
{
var options = new CosmosClientOptions
{
SerializerOptions = new CosmosSerializationOptions
{
IgnoreNullValues = true,
PropertyNamingPolicy = CosmosPropertyNamingPolicy.CamelCase
},
AllowBulkExecution = true
};
return new CosmosClient(_connectionString, options);
}
}
protected Container _cosmosContainer
{
get => _cosmosClient.GetContainer(_databaseId, _containerId);
}
protected async Task<T> CreateItemAsync<T>(string id, T model, PartitionKey partitionKey)
{
try
{
return await _cosmosContainer.CreateItemAsync(model, partitionKey);
}
catch (CosmosException ex)
{
LogCosmosDbError(ex);
throw;
}
}