Custom PropertyChangedEventHandler

May 8, 2008 at 7:44 PM
Iam trying to implement a custom PropertyChangedEventHandler and i therefore receive in the propertyChangedEventArgs the name of the property that has been changed. Is there already a functionality added to the EntityBaseClass to compare the old and the new value of this property?
May 13, 2008 at 6:33 AM


stn_ wrote:
Iam trying to implement a custom PropertyChangedEventHandler and i therefore receive in the propertyChangedEventArgs the name of the property that has been changed. Is there already a functionality added to the EntityBaseClass to compare the old and the new value of this property?



Hi there,

I don't have anything on there that will do it out of the box, but it's a good idea!  I'll put it on the wish list.

For the moment, extend the LINQEntityBase class with your own class (i.e. CustomerEntity inherits {your class} inherits LINQEntityBase}, make the OriginalEntityValue property protected in the LINQEntityBase class, and add to {your class} a method to compare properties.  You can have a look at the ShallowCopy method inside the LINQEntityBase class, which would be very similar code to what would be need for the compare method.

You'll also need to make sure that you re-point your context to the {your class} instead of LINQEntityBase.

Then when the event is raised, call this method and away you go...

This should work.

Cheers

Matt.