>Start by checking the EntityState of the related entities. If they were added to your main entity before it was attached to the context, they are probably detached. If they are detached or unchanged, it won't update them in the database.
The main entity is detached and therefore the related entities are detached as well.
I am thinking is it possible to introduce some generic method in this case or I have to handle on case by case basis?
The interface only allows to add and delete, so I can delete the existing entry and add it again (the ID will be 0 in this case).
I can probably keep the deleted list in the interface and also have another Added property (not mapped) and set it in the interface when adding the entries, then do some extra handling in the repository by looping through Deleted list first (the only problem that it will be in my ViewModel, not the model class, so I would have to handle it through the API/Adapter/Repository) and then something similar for Added entries.
I can do that, but really wanted some generic approach instead of handling it on case by case basis.
If it's not broken, fix it until it is.
My Blog