0

Objective:

I have a form where the user can makes changes to my record object through binding. Once the user has finished making the changes the database is updated using entity framework. If however the user doesn't make any changes I don't want the user to be prompted to save the new values to the database.

For this reason I want to take a snapshot of the Record object when the user opens the form so that I may compare the snapshot to the Record once the user closes the from.

As I understand it when you pass the Record to a new object it is passed by reference which means that the new object will recieve all the changes of the current record and therefore cannot be used for comparison.

Any suggestions on how I could implement such a feature would be much appreciated.

Ryan Searle
  • 1,597
  • 1
  • 19
  • 30

1 Answers1

1

You are able to track changes in record by implementing interfaces INotifyPropertyChanged and IEditableObject. Both of these interfaces allow the object to play nice with databinding. people use IsDirty Flag to track changes.

also look at CSLA it is mature framework which includes object state management (IsDirty)

also look object editing and isDirty() flag it will help you.

Community
  • 1
  • 1
Abdul Rehman
  • 415
  • 5
  • 16