Car*_*lis 22 c# .net-core azure-cosmosdb
我是Azure DocumentDB的新手,我在尝试时遇到了问题.在第一次保存空集合时,我收到以下错误:
ResourceType文档是意外的.
ActivityId:29619975-e55a-4f31-a3d1-73d180ba3932
我的存储库代码(部分)如下:
public interface IEntity
{
string Id { get; set; }
DateTime DbCreatedAt { get; set; }
DateTime DbLastUpdatedAt { get; set; }
}
public class Repository<T>: IRepository<T> where T: class, IEntity
{
private DocumentClient _documentClient;
private string _databaseName;
private string _collectionName;
// ....
// ....
public Task SaveAsync(T entity)
{
var documentUri = UriFactory.CreateDocumentUri(_databaseName, _collectionName, entity.Id);
return _documentClient.UpsertDocumentAsync(documentUri, entity);
}
}
Run Code Online (Sandbox Code Playgroud)
这是第一次将任何内容写入此数据库/集合.难道我做错了什么?
小智 38
UpsertDocumentAsync应该采用DocumentCollection链接,而不是Document链接.
| 归档时间: |
|
| 查看次数: |
4966 次 |
| 最近记录: |