Clear the ChangeSet

Clear the ChangeSet

Postby KKirchhoff » Sat 26 Dec 2009 21:08

Hello how can i clear the ChangeSet (GetChangeSet) and get the old Values ..

becouse the user change some data, and on closing form i ask the question, if he want save the data ... when the user say yes the data will be saved. When the use say "No" the data do not save. But when i close the form again without changed any data, the GetChangeSet shows the old Changes !!!


.GetChangeSet().Inserts.Clear is not possible ..

Thanks for help
KKirchhoff
 
Posts: 14
Joined: Fri 03 Oct 2008 07:43

Postby AndreyR » Mon 28 Dec 2009 11:12

One of the possible solutions is to call the DataContext.Refresh(RefreshMode.OverwriteCurrentValues,
db.GetChangeSet.Updates) method. But this code will make a roundtrip to database.
I recommend you to change the code in some way to call the SubmitChanges method only in case
user says "Yes" and simply dispose the context in case user says "No".
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16


Return to LinqConnect (LINQ to SQL support)