Managed fields. Can I calling other code when property value changes?

Managed fields. Can I calling other code when property value changes?

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


tetranz posted on Thursday, August 28, 2008

Hi all

When using managed fields, is there a way to perform some action within a BO when the value of a property changes? With the conventional type fields I simply call some code within the set code.

Ross

skagen00 replied on Thursday, August 28, 2008

Override OnPropertyChanged in your business object - this is where that sort of code should typically be.

Param passed to the method is the property name, which you'll just need to compare against the static propertyinfo's property name.

Hope that helps,

Chris

tetranz replied on Thursday, August 28, 2008

skagen00:

Override OnPropertyChanged in your business object - this is where that sort of code should typically be.

Param passed to the method is the property name, which you'll just need to compare against the static propertyinfo's property name.

Hope that helps,

Chris



Thanks Chris. I guess that's the way to do it. It just seemed a little untidy because a series of ... if else ... statements always feels out of place in the OO world.

I can't seem to find it now but I think there was some discussion earlier about whether PropertyInfo should have its own PropertyChanged event. Rocky must have decided against it.

Ross

skagen00 replied on Thursday, August 28, 2008

I think I was in that discussion you're mentioning - even if PropertyInfo was passed instead of string, though, we'd still need the if/then statements... not sure how one might get around that one unless perhaps you used string constants when registering your properties - then you could use a case on the various constants.

6 on one, half a dozen....

Chris

 

Copyright (c) Marimer LLC