实体框架 4 CTP5 TPT 继承不适用于深层层次结构?
我在使用 CTP5 中的代码优先 API 映射稍微复杂的继承关系时遇到问题。当我有这个:
Table A
--------
int ID (PK)
Table B
--------
int ID (PK)
varchar Something
public class A {
public int ID { get; set; }
}
public class B : A {
public string Something { get; set; }
}
......一切都很好。但是当我添加以下内容时:
Table C
-------
int ID (PK)
varchar SomethingElse
public class C : B {
public string SomethingElse { get; set; }
}
...然后它会出错,并显示“无效的列名称鉴别器”,这意味着 EF 感到困惑并认为我正在尝试进行 TPH 映射。还有其他人看过这个吗?这是 EF 中的已知问题吗?我需要做一些特殊的映射吗?
预先感谢您的帮助。
I'm having a problem mapping a a slightly more complicated inheritance relationship using the code-first API in CTP5. When I have this:
Table A
--------
int ID (PK)
Table B
--------
int ID (PK)
varchar Something
public class A {
public int ID { get; set; }
}
public class B : A {
public string Something { get; set; }
}
...everything works just fine. But when I add this:
Table C
-------
int ID (PK)
varchar SomethingElse
public class C : B {
public string SomethingElse { get; set; }
}
...then it errors out with "Invalid column name Discriminator", which implies that EF is getting confused and thinks I'm trying to do a TPH mapping. Has anyone else seen this? Is this a known issues in EF? Do I need to do some special mapping?
Thanks in advance for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,代码优先不支持多个级别的层次结构。
as far as I know, hierarchies on multiple levels are not supported in code first.