A
A
Alexey Nikiforov2015-01-20 16:56:26
Entity Framework
Alexey Nikiforov, 2015-01-20 16:56:26

What is the best way to update a model that has a collection of nested entities?

Good afternoon.
What is the best way to update a model that has a collection of nested entities that can also change. For example, there is a department, it has a list of employees (Departments -> List). The user in the web form renamed the department, deleted several employees, added a couple of new ones. How to correctly and simply update all this. Simply assigning a value to the Employees field with a new collection will not work. You can update employees individually, and after updating them, update only the department fields. You can also compare the current and new collections, and manually add/remove new/remote workers. Maybe there is some other way, I just don't know about it?
How would you do?
Found a similar question. ( toster.ru/q/142339)There is just a variant with enumeration and incomplete, because it does not react to the removal of elements from the collection.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question