实体框架代码第一,一张表继承:如何将外键关系放在鉴别器列上?
我首先在 EF 代码中有一个表继承,鉴别器列是一个整数,它是外键..但是当您将列定义为鉴别器时,您必须将其作为基类上的属性删除。并且需要此属性才能在此列上定义外键关系...还有其他方法吗?
A B
TypeId (=discriminator column) ==> Id
I have a one table inheritance in EF Code first, the discriminator column is an integer, which is foreign key.. but when you define a column as a discriminator, you have to remove it as property on the base class. And this property is needed to be able to define a foreign key relationship on this column... is there another way to do it?
A B
TypeId (=discriminator column) ==> Id
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不。您可以使用列定义的鉴别器或外键/关系。它不能同时用于两者。
No. You can have either discriminator or foreign key / relationship defined by the column. It cannot be used for both in the same time.