I've a single object that is opened in an editor. The object is compared to a "Profile" which is a set of rules defined by the user. The user may set up the "Profile" to enforce rule A, rule B, and rule C or the user may set up the profile to enforce only rule A and rule C while ignoring rule B. A user may have several "Profiles".
A profile is used in the AddBusinessRules() to decide which rules are added to the rules collection. The rules are added conditionally.
What happens is if the single object A is opened the static rules for that object are loaded. If that object is closed and a new object B is opened the static rules for object A are still in place. I'm guessing that is because the rules are static and only loaded once. Apparently, the rules are held in memory even if the objects are all closed? Is that correct?
It looks as if the fix is to make all the conditional rules instance rules. Does that sound right?
Actually, in looking over this, is there a way to clear a session so that the business rules are "re added". That is, when I create a new object is created AddBusinessRules is called again?
When I open an object and its checkec by a profile the object loads up static rules and those static rules don't go away when the object is set to null. When a new object of the same type is opened the static rules are still there - I need the static rules to go away when the last instance of an object is closed. (I only ever have one open at a time).
Copyright (c) Marimer LLC