c# - inherit two classes from one base class gives error 3024
I have three t开发者_C百科ables in my database t1, t2 and t3 and t1 is "base" of t2 and t3. Each table has a column named Id and t2 and t3 has also a column named t1Id.
There are also ForeignKey-Constraints on t1.t1Id and t2.t1Id / t3.t1Id with cardinality 1 to 0..1.
In VisualStudio EF-Modeldesigner I generated the following situation:
Indeed there are more columns, but they have nothing to do with my problem ;-). During compile I got two errors with the 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 use POCO-Classes
I can't see where the problem could be. I tried to solve the problem by adding the ForeignKey-association and navigation-properties without success.
You shouldn't add t1id to the derived types, t1id is implied on derived types.
To rebuild the mappings press "Generate Database From Model"
Edit: Put the t1id only on t1, not on T2 and T3
精彩评论