entity-framework – Code First Conventions – Relationship Convention

Code First infer the relationship between the two entities using navigation property. This navigation property can be a simple reference type or collection type. For example, we defined Standard navigation property in Student class and ICollection navigation property in Standard class. So, Code First automatically created one-to-many relationship between Standards and Students DB table by inserting Standard_StandardId foreign key column in the Students table.

public class Student
    public int StudentID { get; set; }
    public string StudentName { get; set; }
    public DateTime DateOfBirth { get; set; }      
    //Navigation property
    public Standard Standard { get; set; }

public class Standard
    public int StandardId { get; set; }
    public string StandardName { get; set; }
    //Collection navigation property
    public IList<Student> Students { get; set; }

The above entities created the following relationship using Standard_StandardId foreign key.

enter image description here

if you want to reproduce, please indicate the source:
entity-framework – Code First Conventions – Relationship Convention - CodeDay