public void InsertOrUpdate(Course t) { using (var ctx = new SchoolModelContext()) { ctx.UpdateGraph(t, map => map.OwnedEntity(c => c.Instructor) .OwnedCollection(c => c.Enrollments, with => with.OwnedEntity(s => s.Student)) ); ctx.SaveChanges(); } }
public void InsertOrUpdate(Instructor t) { using (var ctx = new SchoolModelContext()) { ctx.UpdateGraph(t, map => map.OwnedCollection(i => i.TeachingCourses, with1 => with1.OwnedCollection(o => o.Enrollments, with2 => with2.OwnedEntity(e => e.Student).OwnedEntity(e => e.Course))) ); ctx.SaveChanges(); } }