The user ask to update some of the instances (let it be the third one in the list). Then, to be kind, the app does a
Code: Select all
Entity currentState = toBeUpdated.Clone(); // generated Clone() method // the dataContext is the same used to retrieve the original List<Entity> from a query dataContext.Refresh( RefreshMode.OverwriteCurrentValues, toBeUpdated); // check if someone updated the record if ( ! currentState.Compare(toBeUpdated) // extension method which compares property by property using reflection return "record was modified"; else return "updateIt!".
Also (and very important), what is the result of Refresh() if the instance passed as argument was deleted?
Does it throws an exception?