Configure One-to-Many Relationship

relational-database-fundamentals-36-638

The Standard and Teacher entities have a One-to-Many relationship marked by multiplicity where 1 is for One and * is for many. This means that Standard can have many Teachers whereas Teacher can associate with only one Standard.

To represent this, The Standard entity has the collection navigation property Teachers (please notice that it’s plural), which indicates that one Standard can have a collection of Teachers (many teachers). And Teacher entity has a Standard navigation property (Not a Collection) which indicates that Teacher is associated with one Standard. Also, it contains StandardId foreign key (StandardId is a PK in Standard entity). This makes it One-to-Many relationship.

The content is taken from

http://www.entityframeworktutorial.net/code-first/configure-one-to-many-relationship-in-code-first.aspx

Leave a Reply

Your email address will not be published. Required fields are marked *