实体框架4:继承和关联 [英] Entity Framework 4: inheritance and Associations
本文介绍了实体框架4:继承和关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从提供跟踪的基类派生我的实体。
I do derive my entities from a base-class that provides tracking.
由于用户
派生自 TrackableBase
和 TrackableBase
与用户
相关联,我收到错误:
Since User
derives from TrackableBase
and TrackableBase
is associated with User
, I get an error:
无法确定依赖操作的有效排序。
由于外键约束,模型
要求或存储,可能存在依赖关系生成的值。
"Unable to determine a valid ordering for dependent operations. Dependencies may exist due to foreign key constraints, model requirements or store generated values."
这个模型是不可能的,还是我做错了什么?
Is this model just not possible, or am I doing something wrong?
推荐答案
CreatedByUser是一个可以为空的foriegn键吗?如果没有,您将获得循环引用。
Is CreatedByUser a nullable foriegn key? If not, you'll get a circular reference.
相关:实体框架中的循环依赖
/ mikkel
这篇关于实体框架4:继承和关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文