# Reject changes with LINQ

**URL:** https://talk.remobjects.com/t/reject-changes-with-linq/16484
**Category:** Data Abstract
**Tags:** net
**Created:** [May 24, 2018, 2:10pm UTC](https://talk.remobjects.com/t/reject-changes-with-linq/16484 "2018-05-24T14:10:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![matteo](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/f9ae1b/32.png) [@matteo](https://talk.remobjects.com/u/matteo)
#### Post date: [May 24, 2018, 2:10pm UTC](https://talk.remobjects.com/t/reject-changes-with-linq/16484/1 "2018-05-24T14:10:08Z")

</div>

Given the example

…  
DataAdapter.GetTable\<\>().UpdateRow(\_modifiedBook);  
try  
{  
DataAdapter.ApplyChanges();  
}  
catch  
{  
DataAdapter.CancelChanges();  
}

CancelChanges method “frees” Delta changes, but as far as I can see (differently from the DASQL approach) \_modifiedBook is not set at the original state. Am I right?  
If no, what’s my wrong assumption? If yes, I saw that in the “table definitions” file there is a BeginUpdate method that could be suitable, but not in a “WPF binding scenario” like mine (I think). Is there a DataAbstract way to achieve that without tons of boilerplate code?

---

<div class="post-metadata">

### Author: ![antonk](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@antonk](https://talk.remobjects.com/u/antonk)
#### Post date: [May 24, 2018, 2:49pm UTC](https://talk.remobjects.com/t/reject-changes-with-linq/16484/2 "2018-05-24T14:49:22Z")

</div>

> [@matteo](#):
>
> Is there a DataAbstract way to achieve that without tons of boilerplate code?

It is more like a WPF area of responsibility, not DA’s.

What I would do is to call `.BeginUpdate` on data entity before it enters edit mode (or even on each element of  
a `DABindingList` if you use it).

Then define a helper method that will access the `m ____ OldValues` field via reflection and will assign property values of this object back to corresponding parent object’s properties. Then call this method when you need to revert changes made to an object.

---

<div class="post-metadata">

### Author: ![matteo](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/f9ae1b/32.png) [@matteo](https://talk.remobjects.com/u/matteo)
#### Post date: [May 30, 2018, 4:24pm UTC](https://talk.remobjects.com/t/reject-changes-with-linq/16484/3 "2018-05-30T16:24:59Z")

</div>

> [@antonk](#):
>
> It is more like a WPF area of responsibility, not DA’s.

Maybe I’m wrong but EntityFramework, Devart’s ORM, Devexpress’ ORM etc. use their change tracker to assolve the “reject changes” task (in generated code) even if they’re not part of WPF. Anyway thank you for the workaround, I just thought that DA was capable of doing that out of the box like its “cousins”
