1

I have a wpf window wherein grid is bound to entityCollection. herein I add/delete a record to grid and then click cancel button. How can I revert the chages made to the entitycollection.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Rakesh
  • 310
  • 3
  • 19

2 Answers2

1

Doesn't EF require you to call SavChanges() before anything is saved in to the database? You don't need to add a cancel button but rather a save button.

synepis
  • 1,292
  • 16
  • 28
1

if your objects states were changed you can't do anything without reloading collection from server using with Overwrite option.

In better case you may use Memento pattern.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
ASpirin
  • 3,601
  • 1
  • 23
  • 32