I am not sure if I'm doing something wrong or if this behavior is "by design".
Let's say I have Order entity that holds a collection of Product as a navigation property.
1) I fetch Order by id with an expand on Product collection
2) In the database, I manually delete some Product records and I create new ones before assigning them to my Order entity
3) I repeat step 1).
In the network payload I can tell that the collection of Product returned from the server does NOT contain the Product entities removed from DB. It does contains the new ones + the ones that were not deleted.
However, now on the client side, the Order entity contains all the Product entities that were loaded the first time + the new ones. The one that were removed from DB are still in the client-side collection.
Do i have to manually diff the existing collection with the one coming back from server and detach them myself ?
I am not sure if I'm doing something wrong or if this behavior is "by design".
Let's say I have Order entity that holds a collection of Product as a navigation property.
1) I fetch Order by id with an expand on Product collection 2) In the database, I manually delete some Product records and I create new ones before assigning them to my Order entity 3) I repeat step 1).
In the network payload I can tell that the collection of Product returned from the server does NOT contain the Product entities removed from DB. It does contains the new ones + the ones that were not deleted.
However, now on the client side, the Order entity contains all the Product entities that were loaded the first time + the new ones. The one that were removed from DB are still in the client-side collection.
Do i have to manually diff the existing collection with the one coming back from server and detach them myself ?