I work with on MVC project using entity framework with repository and Unit of work pattern, I'm trying to edit variable length collection in edit action(master details) like example in this post http://ivanz.com/2011/06/16/editing-variable-length-reorderable-collections-in-asp-net-mvc-part-1
My problem is every time submit form to edit action the child collection DB table duplicate child collection rows and set foreign key of old ones to null,and modify the master entity successfully . i check the entity state of the master entity is deatached(child collection also deatached).
I have work around to loop throw child collection and change it's state to modified or added or deleted,But what i need to know what is the best solution this problem to automatically detect changes or not to change entity state to deatached.
Thanks