I am using CSLA and silverlight in my project. I am using the calculation business rules. There is a situation that one calculation rule has to be applied on one or more properties (which is already been set by another calculation rule). In the UI, both are shown in Label and cannot be directly edited. Although, one of the Labels changes when the first rule fires, but this change doesn't fire the second rule (which is dependent on the value of first label) and the value of the second Label is not affected. However, when we save the page, and when the page reloads again, then the calculation fire and set the value of that property.
Rule1_ChangingLabel1(prop1, prop2, targetprop)
--> When there is a change in prop1 or prop2, this calculates the 'targetprop' (in Label).
When the value of 'targetprop' changes by the above rule, the second rule below should fire.
Rule2_ChangingLabel2(targetprop, prop3, prop4)
But the second rule doesn't fire when the 'targetprop' changes.
Could this be because it is in a Label? I would be thankful if anyone could let me know some solution.
No , this has nothing to with it being a label.
Which version of CSLA do you use?
The CSLA version is:
Version - 18.104.22.168
Runtime Version - v4.0.30319
Look at these posts:
They describe how the rule engine works internally.
So you probably hit the barrier of "only 1 level down" on dependent properties.
I tried making primaryproperty of dependent rule as AffectedProperty in rule 1 but still doesn't work.
Could you please elaborate on the second point?
Dependend properties is only checked for the first level. IE: It is not recursive.
Which meand that when Property1 is changed:
BUT - not in a recursive manner - so if Property3 is an AffectedProperty of 2) above it will not be revalidated.
Copyright (c) Marimer LLC