Entity Framework Mapping Problems

  • Thread starter Thread starter tal_mcmahon
  • Start date Start date
T

tal_mcmahon

Hello all,

I am playing with entity framework trying to decide if it is fully
baked yet for anything of substance. I am coming up against what
appears to be an issue. I have seen Greg Beamer address some entity
framework issues in these forums but nothing that specifically says
"this cannot be done".

I have 4 tables, Person,Teacher, Course, and CourseTeacher.

You may be able to see where I am going here...

A teacher is a person, a teacher teaches more than one course.

I can make the many to many between Teacher and Course (through
CourseTeacher).
I can make a table - per - type inheritance for Person and Teacher
(given the caveat that teacher are really people).

When I do both together I get 'Error 3021: Prolem in Mapping
Fragment...CourseTeacher.PersonID is mapped to
<FK_CourseTeacher_Teacher.Teacher.PersonID,
FK_CourseTeacher_Teacher.CourseTeacher.PersonID>'

I have deduced that I am getting the error because I am making an
association TeacherCourseTeacher that can only see the Scalar
properties of Teacher and the scalar properties of Teacher do not
include the PersonId because that is inherited from the Person table.

So in effect it looks like I cannot make "Two hops" like this:
Person.PersonId--> Teacher.PersonId --> CourseTeacher.PersonId


anyone have more to add?


Thanks

Tal McMahon
 
Just to add to some of the fun on this,
Seems like If I Create the entities without the RI in the database,
then add the RI and Update the Many to Many (CourseTeacher) it
Validates.

Poking into the XML When you use 2 steps as indicated above, the
wizard makes a CourseTeacher1 association and does all of its linking
with the CourseTeacher1 reference.


anyone else??

Tal
 
Back
Top