Update and Add Child Rows at same time with Entity Framework
问题 i´m having some troubles when it comes to modify and add child rows at the same time. I´m using the technique from the answer: stackoverflow.com/questions/5557829/.... The problem is in the following code: public void EditReport(tbl_inspection inspection) { foreach (var roll in inspection.tbl_inspection_roll) { container.tbl_inspection_roll.Attach(roll); container.ObjectStateManager.ChangeObjectState(roll, (roll.id_inspection_roll == 0) ? EntityState.Added : EntityState.Modified); } container