简体   繁体   English

插入多个继承的实体会产生-无法确定关系的主要终点

[英]Inserting Multiple Inherited Entities Gives - Unable to determine the principal end of the relationship

I'm using EF5 and I'm having an issue where I can add 1 instance of an inherited entity and save it successfully, but if I add two or more instances of the type, I run into the issue below. 我正在使用EF5,但遇到一个问题,我可以添加1个继承实体的实例并成功保存,但是如果添加两个或多个该类型的实例,则会遇到以下问题。

These entities are inherited types from a base type. 这些实体是从基本类型继承的类型。 FkEssayItemContent is the FK relationship that ties my type, EssayItem , to it's base, Content . FkEssayItemContent是将我的类型EssayItem与它的基础Content绑定的FK关系。

Unable to determine the principal end of the 
'TDSModel.FkEssayItemContent' relationship. 
Multiple added entities may have the same primary key.

What am I missing here, such that one entity would insert fine, but two of them inserted at once would cause this problem when using inheritance? 我在这里缺少什么,这样一个实体可以很好地插入,但同时插入两个实体会在使用继承时导致此问题?

Thanks! 谢谢!

I ended up answering this myself. 我自己回答了这个问题。 It turns out that in addition to an inheritance relationship, the model had an association between EssayItem and `Content'. 事实证明,除了继承关系之外,该模型EssayItem和“ Content”之间建立了关联。 Removing that association and maintaining the inheritance fixed the issue. 删除该关联并维护继承可解决此问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法确定etaxiDataModel关系的主要结尾。 多个添加的实体可以具有相同的主键 - Unable to determine the principal end of the etaxiDataModel relationship. Multiple added entities may have the same primary key 无法确定 X 关系的主端。 多个添加的实体可能具有相同的主键 - Unable to determine the principal end of the X relationship. Multiple added entities may have the same primary key 无法确定关系的主要终点,多个添加的实体可能具有相同的主键 - Unable to determine the principal end of the relationship, Multiple added entities may have the same primary key 无法确定“ MyApp.Data.AAA_BBB”关系的主要结尾。 多个添加的实体可能具有相同的主键 - Unable to determine the principal end of the 'MyApp.Data.AAA_BBB' relationship. Multiple added entities may have the same primary key 无法确定“ Vehicle_VehicleClass”关系的主要结尾。 多个添加的实体可能具有相同的主键 - Unable to determine the principal end of the 'Vehicle_VehicleClass' relationship. Multiple added entities may have the same primary key C#无法确定关系的主要结束 - C# Unable to determine the principal end of the relationship EF6:2x一对一关系给出错误“无法确定关联的主要终点” - EF6 : 2x a one to one relationship gives error “Unable to determine principal end of association” 无法确定主端 - Unable to determine the principal end 无法确定关系的主要终点ASP.NET MVC 5 - Unable to determine the principal end of the relationship ASP.NET MVC 5 实体框架关系问题“无法确定主要目标……” - Entity framework relationship issue 'Unable to determine the principal end…'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM