I found these entities in one of Microsoft tutorials:
public class Enrollment
{
public int Id{ get; set; }
public int StudentId { get; set; }
public Student Student { get; set; }
}
public class Student
{
public int Id { get; set; }
public ICollection<Enrollment> Enrollments { get; set; }
}
Do I really need to define StudentId property?
How the case will differ in case of different types of relationshipts? for example one-one and one-many?
UPDATE:
In this link http://www.learnentityframeworkcore.com/relationships we can see that in One-Many and Many-Many, they did not define the Id foreign key property, but in One-One, they did. Why is that?