Is it really impossible to update child collection in EF out of the box (aka non-hacky way)?
- 阅读更多 关于 Is it really impossible to update child collection in EF out of the box (aka non-hacky way)?
Let's say you have these classes in your entities. public class Parent { public int ParentID { get; set; } public virtual ICollection<Child> Children { get; set; } } public class Child { public int ChildID { get; set; } public int ParentID { get; set; } public virtual Parent Parent { get; set; } } And you have a user interface to update the Parent along with its Children , meaning if the user add new Child then you have to insert, if the user edits an existing Child then you need to update, and if the user removes a Child then you have to delete. Now obviously if you use the following code