Getting started with EF Core

Add related entity

Relationships

A relationship defines how two entities relate to each other. In a relational database, this is represented by a foreign key constraint.

Definition of terms

There are a number of terms used to describe relationships

  • Dependent entity: This is the entity that contains the foreign key properties. Sometimes referred to as the 'child' of the relationship.

  • Principal entity: This is the entity that contains the primary/alternate key properties. Sometimes referred to as the 'parent' of the relationship.

  • Principal key: The properties that uniquely identify the principal entity. This may be the primary key or an alternate key.

  • Foreign key: The properties in the dependent entity that are used to store the principal key values for the related entity.

  • Navigation property: A property defined on the principal and/or dependent entity that references the related entity.

    • Collection navigation property: A navigation property that contains references to many related entities.

    • Reference navigation property: A navigation property that holds a reference to a single related entity

Last updated