Before you tell me to read the documentation (I already did), I understand that it's choosing to take whatever's different currently and fill in the rest w/ database values. What I want to know is how it decides which version to keep because I seem to be
running into a problem where it detects conflict, but didn't save any of my new values even with RefreshMode.KeepChanges option.
So while debugging, I see that it detects the conflict I anticipated, along with 3 others not as expected. One is the timestamp field (not sure if it should've shown up as a conflict) and two other fields. All three fields current value is null, while there's
some data in the db's version. How does the conflict get resolved exactly? Is there a way I can get the source and look for myself?
(Side question: Something that bugged me when I was reading about how to use Attach(), it mentions NOT to query the db to find the original values. Well, then how do you EVER get the original values if you didn't query for it at some point in time? Do
they mean don't do it in the same DataContext you're going to use to Attach() and SubmitChanges()? I'm trying to understand if I can use Attach() to update values and I'm finding mixed info online. Is there no way to avoid the ugly assignment of each field
to be updated? It often goes upward of a dozen :( )
Linq to SQLKeepChangesdetached entitiesObjectChangeConflictAttachRefreshMode
halokitty82
0 Points
2 Posts
How does ObjectChangeConflict resolve RefreshMode.KeepChanges?
Apr 17, 2010 12:48 AM|LINK
Before you tell me to read the documentation (I already did), I understand that it's choosing to take whatever's different currently and fill in the rest w/ database values. What I want to know is how it decides which version to keep because I seem to be running into a problem where it detects conflict, but didn't save any of my new values even with RefreshMode.KeepChanges option.
So while debugging, I see that it detects the conflict I anticipated, along with 3 others not as expected. One is the timestamp field (not sure if it should've shown up as a conflict) and two other fields. All three fields current value is null, while there's some data in the db's version. How does the conflict get resolved exactly? Is there a way I can get the source and look for myself?
(Side question: Something that bugged me when I was reading about how to use Attach(), it mentions NOT to query the db to find the original values. Well, then how do you EVER get the original values if you didn't query for it at some point in time? Do they mean don't do it in the same DataContext you're going to use to Attach() and SubmitChanges()? I'm trying to understand if I can use Attach() to update values and I'm finding mixed info online. Is there no way to avoid the ugly assignment of each field to be updated? It often goes upward of a dozen :( )
Linq to SQL KeepChanges detached entities ObjectChangeConflict Attach RefreshMode