Object Validation

Object Validation

Old forum URL: forums.lhotka.net/forums/t/8169.aspx


alagesan posted on Tuesday, December 15, 2009

hi.,
iam using CSLA 3.5 framework
 when user change any field in the object ,i want create commonly  one function .
that event will fire any of property changed in the object

will it possible like this?

rxelizondo replied on Tuesday, December 15, 2009

I am assuming that you don't really mean "field" but you mean "property". If this is the case, the simplest way I can think of right now would be to override the "OnPropertyChanged" method in your business object as follows:


protected override void OnPropertyChanged(string propertyName)
{
base.OnPropertyChanged(propertyName);
Console.WriteLine("Hello from property " + propertyName);
}

Copyright (c) Marimer LLC