I use entity framework eager load approach since I have to provide the client the whole hierarchy.
On the way back I can see that the object in the context is identical to the object that the client returned (I assume that the context is updated with that object although it doesn't manage the entries state).
Question #1 -
Do I have to bring the "old" entity from the DB and start comparing? (A hit to the db...)
Question #2 -
I have read the solution given by Slauma in Entity framework, problems updating related objects discussion.
Do you realy have to do all the comparison logics between both objects?
Question #2.1 -
Can't you avoid code like
// Update subFoos that are in the newFoo.SubFoo collection
context.Entry(dbSubFoo).CurrentValues.SetValues(newSubFoo);
The code suggested there is a nightmare to write and maintain.
I would really appreciate advice for that situation.
Something that maybe won't be elegant but it least reasonable.