Entity framework core 宇宙数据库错误“;StartIndex不能小于零“;添加到实体集合时

Entity framework core 宇宙数据库错误“;StartIndex不能小于零“;添加到实体集合时,entity-framework-core,azure-cosmosdb,Entity Framework Core,Azure Cosmosdb,我正在尝试使用entity Framework Core Cosmos DB添加到实体集合中 此代码: _repository.Accounts.Add(account) 引发此异常: StartIndex不能小于零。(参数“startIndex”) 有什么想法吗?我想出来了 EF Core Cosmos DB不计算JsonProperty属性 因此,我必须改变这一点: [JsonProperty("id")] public string Identifier { get; set; } 为

我正在尝试使用entity Framework Core Cosmos DB添加到实体集合中

此代码:

_repository.Accounts.Add(account)
引发此异常:

StartIndex不能小于零。(参数“startIndex”)

有什么想法吗?

我想出来了

EF Core Cosmos DB不计算JsonProperty属性

因此,我必须改变这一点:

[JsonProperty("id")]
public string Identifier { get; set; }
为此:

private string id { get; set; }

[NotMapped]
public string Identifier
{
   get => id;
   set => id = value;
}
现在一切都好了