Search code examples
entity-framework-ctp5

Entity Framework 4 CTP5 TPT inheritance not working for deep hierarchy?


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.


Solution

  • as far as I know, hierarchies on multiple levels are not supported in code first.