LueTm
LueTm

Reputation: 2380

RejectChanges for specific Entities

I'm having the following issue with WCF RIA Services: I have a table Customer and a table Address. A customer can have 0...n addresses. There is a form for editing the customer, with a Datagrid that displays the addresses. You add / edit an address in a child window by clicking Add / Edit. Now here's the thing:

The problem is that the user should always be able to cancel edits. This is not a problem except: If you create a new customer and you add an address to that customer, then want to edit the address but want to cancel that edit.

How would you guys solve that?

Upvotes: 5

Views: 1057

Answers (2)

Sajid Ali
Sajid Ali

Reputation: 779

It's working in case of edit but not in case of new..

Upvotes: 0

Kyle McClellan
Kyle McClellan

Reputation: 2029

Entity implements IRevertibleChangeTracking to support this scenario. Since it's implemented explicitly, you'll have to cast it. The following code will work.

((IRevertibleChangeTracking)address).RejectChanges();

Upvotes: 6

Related Questions