Changes to To BusinessRules in 4.3 (or 4.2)?

Changes to To BusinessRules in 4.3 (or 4.2)?

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


jwadecsee posted on Monday, October 22, 2012

Hello,

I recently upgraded my company's framework from 4.1 to 4.3. We make pretty extensive use of BusinessRules. We have several different named sets of rules that run in different situations. So in our extension of BusinessBase we have some methods that do stuff like this:

void CheckValidationRules()

            if (this.IsSelfDirty)

            {

                BusinessRules.SuppressRuleChecking = false;

                BusinessRules.RuleSet = "Validation";

 

                BusinessRules.CheckRules();

 

                BusinessRules.RuleSet = "default";

                BusinessRules.SuppressRuleChecking = true;

            }

           ........

 

After the upgrade to 4.3, I had to remove the line that sets the RuleSet back to "default." I found that every time you change the RuleSet name, any results are being cleared.

This certainly wasn't a big deal, I just wanted to confirm that this is expected behaviour. I couldn't find it documented anywhere. Could anyone confirm?

 

Thanks,

Joe

JonnyBee replied on Monday, October 22, 2012

Yes, that change was intentional. 

This was done as part of the overhaul to make the rule engine support rules that add XYZResult to other properties.
This may have seemed to work earlier - but in reality did not.

Rulesets should be considered as entirely different sets of rules and cannot be mixed.  
A BO can only have one active ruleset at any time. 

jwadecsee replied on Monday, October 22, 2012

Great, thanks!

Copyright (c) Marimer LLC