views:

21

answers:

1

When update/modify entity property, I can put business logic in property changed event like:

partial void OnMyPropertyChanged()
{
  //....
}

In this event handler, I want to know the new value and original value for MyProperty. New value can be get by this.MyProperty. How to get the original value?

For example, if udpate MyProperty from 1 to 2, original value is 1, new value is 2. this.MyProperty = 2. but how to get the original value 1?

A: 

In EF2 the Entities are also implementing INotifyPropertyChanging. I don't know if it's the same in EF4. You should be able to listen to the PropertyChanging event and so read the value of the property before it is changed.

DHN