Retrieving dependents in a business object.

Retrieving dependents in a business object.

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


GreatBarrier86 posted on Friday, July 16, 2010

Hello,

I'm using the ValidationRules.AddDependentProperty() function to do the following: 

ValidationRules.AddDependentProperty(_addr1Property, _cityProperty);

Then, i use ValidationRules.AddRule() to do the following

ValidationRules.AddRule(ValidateAddressFieldIfAddr1IsFilled, _cityProperty);

 Would it be possible to retrieve the dependency information when the ValidateAddressFieldIfAddr1IsFilled executes? Is there a way to tell if _addr1 has _city as a dependent, or vice versa?

Thanks, any help would be appreciated

Jason

RockfordLhotka replied on Saturday, July 17, 2010

I don't think there's any way to get at the lists of dependent properties, no.

What is the scenario where that information is important?

fussion_am replied on Tuesday, July 20, 2010

Doesn't CheckRules(string propertyName) return a string array of all properties that had their rules checked?

GreatBarrier86 replied on Wednesday, July 21, 2010

I have a function that clears the values of 2 properties if a certain other property is unchecked. Therefore, the 2 properties to be cleared are set as dependants of the checked/unchecked property. The problem is that this has to occur 2 times with two different sets of properties.

fussion_am replied on Wednesday, July 21, 2010

Ah, yeah that would be a problem.  I actually had the same need for a side project I had been playing around with.  I was thinking about having a 'RulesBuilder' that would attach rules to a BO.  Some of the 'RulesBuilder' methods needed to know whether or not a dependency was already created between various properties so it could (or not) create the dependency.

 

+1 for a method by which we can query what properties are dependent on what properties (not sure if this sentance is the best description of the request)

Copyright (c) Marimer LLC