C # - inherit two classes from one base class, gives error 3024

I have three tables in my database t1, t2 and t3, and t1 is the "base" for t2 and t3. Each table has a column named Id and t2, and t3 also has a column named t1Id.

There are also ForeignKey-Constraints on t1.t1Id and t2.t1Id / t3.t1Id with power from 1 to 0..1.

In VisualStudio EF-Modeldesigner, I created the following situation:

Basic picture of the situation

Indeed, there are more columns, but they have nothing to do with my problem ;-). During compilation, I received two errors with error code 3024:

Problem in mapping fragments starting at line xy: Must specify mapping for all key properties t1.t1Id of the EntitySet t1s 

EDIT: I am using POCO classes

I do not see where the problem is. I tried to solve the problem by adding ForeignKey association and navigation properties without success.

+4
source share
1 answer

You should not add t1id to derived types, t1id is implied on derived types.

To rebuild the mappings, click Create Database From Model

Edit: put t1id only on t1, not on T2 and T3

+4
source

All Articles