An entity relationship is implemented in the POCO entity classes by defining a navigation property that references the other entity class type.
When the multiplicity is many (e.g. 0..*, 1..*) the relationship is implemented via an ICollection<TENTITY> of the related type.
Consequently, objects that refer to each other using property references or collections of references can be navigated using “dot” notation.
A relationship defined in the code should reflect:
1. An existent Primary Key/Foreign Key defined (existent database)/to define (new database) in the relational database;
2. A configuration using a DataAnnotation attribute or via the Fluent API
In order to identify a relationship with DataAnnotation attributes the focus of the analysis is its navigation properties.
In order to identify a relationship with the Fluent API the Model Builder is used: The pattern followed uses a two part fluent expression to configure navigation properties within the model:
where [Multiplicity] can be:
- Optional (a property that can have a single instance or be null),
- Required (single instance),
- Many (a property with a collection of a single type)
- The first part of the expression which defines the navigation property on the current entity; and
- The second part of the expression which defines the reverse navigation property.
How To Do It
 Refer to the following articles for information about configuring One-To-Zero or One using Fluent API:
- One to zero/one relation in entity framework code first
- Understand basic navigation with Entity Framework Code First (4.3) with 1 to 0..1 relationship
 Refer to the following articles for information about configuring One-To-Zero or One using Fluent API and DataAnnotation:
- Entity Framework 4.1 – One To One Mapping
- Associations in EF Code First: Part 5 – One-to-One Foreign Key Associations
 Refer to the following articles for information about configuring One-To-Many using Fluent API and DataAnnotation:
- Entity Framework Code First – Specify foreign key name in one to many relationship with fluent API
- Associations in EF Code First: Part 6 – Many-valued Associations
- Entity Framework Tutorial: Configure One-to-Many Relationship
 Refer to the following articles for information about configuring relationships with the Fluent API:
[56 Refer to the following articles for questions and answers about configuring relationships (usefull samples):
- How to map child entity to parent entity without introducing primitive type parent linker in child entity?
- How I made EF work more like an object database ?
- Entity Framework Code First optional one-to-one relationship with no reverse navigation property
- Difference between .WithMany() and .WithOptional() ?