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);
Then, i use ValidationRules.AddRule() to do the following
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
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?
Doesn't CheckRules(string propertyName) return a string array of all properties that had their rules checked?
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.
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