I am using EF5 as my ORM tool. I have a relationship between 3 tables in the DB as follows:
Table 1 is the main table. It has a "1 to 0..1" relationship to Table 2. Table 2 has a "many to 1" relationship to Table 3.
Now when you import this into EF, it collapses (hides) Table 2. You get to Table 3 by doing something like:
Table1.Table3
Basically in my T4 template for generating code, I need to know if the relationship between Table 1 and Table 3 is hiding a middle table.
How can I do this?
It is easy for a many to many table link, as I can look at the navigation properties relationship multiplicity as follows:
if (navProperty.FromEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many &&
navProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
And I will know a table is missing inbetween, but with the model above, it becomes a many to 0..1 relationship, which may or may not be hiding a middle table.
Any ideas?