I have a one-to-many relationship defined below
public class Student{
[key]
public string Id{get; set;}
public string name{get; set:}
public virtual List<Enrollment> Enrol{get; set;}
}
public class Enrollment{
public int Id{get; set;}
[ForeignKey("student")]
public String StudentId{get; set;}
Public string ISC{get; set;}
public virtual Student student{get; set;}
}
I have a form allowing me to edit a Student entity including adding or removing some enrollments. When saving this data after the form is submitted, does the enrollments get updated too, or do I have to update the enrollments separately? Ideally, should the enrollment by deleted and then re-inserted or just updated (and doing inserts only when there are more new items than there are existing ones)?