I am using EF 4.1 RC and CodeFirst / POCO to create my database from code.
Imagine a number of relationships like teacher-student (many people can be a teacher, and a student can have many teachers). Accordingly I have two POCOs: (1) Teacher and (2) Student
When EF prepares related tables, you will end with three tables: (1) Teacher, (2) Students And (3) an additional entry table joining table consists of two fields: a teacher_id and a student_id.
I was thinking that I have a chance to get involved in any additional area, for example "grade" (grade gives a certain teacher a certain teacher)?
Currently I do not know how to get it with only two POCOs
So I think that whatever I can do is join the third pok (table of joining) Manually created for, am I right? It will definitely work, but then I'm losing some kind of navigation properties. teacher. Students.First (), etc. This is the main reason I'm still exploring another method.
This is true, and applies not only on code-for the first time if your joining table If there are additional fields, you will be mapped as a unit. And on the contrary, if you want an extra area in your joining table, then you have multiple or one-to-many navigation properties for creating a new unit and for zero or multiple codes. > And Alternatively, you can think of modeling dB structure differently and additional information can be found in Student Institutions In any case, you lose the ability to get recipients from the
teacher.and reference and
students. Teachers have to go through the and intermediate unit.
teacher or
student or fourth unit Can remove But it depends entirely on your scenario.
Comments
Post a Comment