Mysql EF6包含/选择多个实体级别抛出NotSupportedException

Mysql EF6包含/选择多个实体级别抛出NotSupportedException,mysql,entity-framework,Mysql,Entity Framework,这似乎非常类似于: 但是异常消息是不同的,我们正在使用新的库 尝试加载由以下三个级别组成的实体图:包含多个AccountingOperation的Accounting Record,而每个AccountingOperation又包含多个AccountingOperationLine。如果我想在第三级(1个综合帐户和2个分析帐户)上加载3个导航属性,则会出现以下异常,如下所示 代码: 由于AccountingSynthetic和AccountingRecordOperation不共享id,因此EF

这似乎非常类似于: 但是异常消息是不同的,我们正在使用新的库

尝试加载由以下三个级别组成的实体图:包含多个AccountingOperation的Accounting Record,而每个AccountingOperation又包含多个AccountingOperationLine。如果我想在第三级(1个综合帐户和2个分析帐户)上加载3个导航属性,则会出现以下异常,如下所示

代码:

由于AccountingSynthetic和AccountingRecordOperation不共享id,因此EF显然存在一些混淆

配置:

  • 模型优先
  • TPT
  • MySQL 5.6
  • MySQl连接器6.8.3
  • EF 6.0
注:

  • 所有实体都继承实体的属性
  • 综合账户和分析账户都与会计业务线有一对多的关系(这会混淆EF吗?)
即使使用以下更简单的查询,错误仍然存在:

var v = dbEntities.Set<AccountingRecord>()
    .Include(ar => ar.AccountingRecordOperations.Select(aro => aro.AccountingRecordOperationLines.Select(arol => arol.AccountingSynthetic)));
var v=dbEntities.Set()
.Include(ar=>ar.AccountingRecordOperations.Select(aro=>aro.AccountingRecordOperationLines.Select(arol=>arol.AccountingSynthetic));

您是否彻底检查了导航属性的类型?它们非常相似,因此使用intellisense很容易出错。是的,我在发布之前检查了-报告的实体类型之间没有共享ID。导航属性是正确的,稍后我将发布一个模型图,其中只包含所涉及的类。很显然,我需要10个信誉来添加一个图像…我通过升级到mysql connector 6.9.1解决了这个问题
NotSupportedException: All objects in the EntitySet 'DbEntities.Entities' must have unique primary keys. 
However, an instance of type '...AccountingSynthetic' and an instance of type '...AccountingRecordOperation' both have the same primary key value, 'EntitySet=Entities;ID=1104'
var v = dbEntities.Set<AccountingRecord>()
    .Include(ar => ar.AccountingRecordOperations.Select(aro => aro.AccountingRecordOperationLines.Select(arol => arol.AccountingSynthetic)));