Clear the ChangeSet

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
KKirchhoff
Posts: 14
Joined: Fri 03 Oct 2008 07:43

Clear the ChangeSet

Post by 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

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by 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".

Post Reply