【问题标题】:Entity Framework 4 CTP5 TPT inheritance not working for deep hierarchy?实体框架 4 CTP5 TPT 继承不适用于深层层次结构?
【发布时间】:2011-03-25 18:29:05
【问题描述】:

我在使用 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 中的已知问题吗?我需要做一些特殊的映射吗?

提前感谢您的帮助。

【问题讨论】:

    标签: entity-framework-ctp5


    【解决方案1】:

    据我所知,代码首先不支持多层次的层次结构。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-18
      • 2023-04-09
      • 1970-01-01
      • 1970-01-01
      • 2010-11-24
      • 2014-12-22
      相关资源
      最近更新 更多