Publish rule-status notification¶
This operation dispatches clsRulesManagerBase's rule-status events after a subclass decides — through whatever validation logic it implements — that a rule has become broken or is no longer broken. Unlike Notify modified-state change, the two methods here invoke their event delegates without first checking for a subscriber, which makes a listener mandatory rather than optional (see BR-001).
| Field | Value |
|---|---|
| Operation ID | OP-BIND-007 |
| Trigger | Subclass call to OnRuleBroken(rule) or OnRuleNotBroken(rule). |
| Inputs | object rule. |
| Outputs | RuleBroken(rule) or RuleNotBroken(rule) when a subscriber is attached; otherwise a NullReferenceException. |
| Primary components | clsRulesManagerBase.OnRuleBroken, clsRulesManagerBase.OnRuleNotBroken |
| Entry point | SAIF.Framework.Bindable\clsrulesmanagerbase.cs |
Steps¶
- A subclass calls
OnRuleBroken(rule)orOnRuleNotBroken(rule)on the currentclsRulesManagerBaseinstance, depending on which state transition it detected. - The method selects the event delegate matching that call:
RuleBrokenfor a broken-state notification,RuleNotBrokenfor a resolved-state notification. - The method invokes the selected delegate directly with the supplied
ruleargument, with no null check beforehand (BR-001). - If a subscriber is attached, its handler executes and control returns normally to the caller.
- If no subscriber is attached, the direct delegate invocation throws
NullReferenceException, and that exception propagates up throughOnRuleBroken/OnRuleNotBrokento the subclass that triggered the notification (BR-001).
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Subclass calls OnRuleBroken or OnRuleNotBroken]) --> Check{Matching subscriber attached?}
Check -->|Yes| Raise[Invoke matching rule-status event]
Check -->|No| Err([NullReferenceException propagates])
Raise --> EndOk([Notification delivered])
Failure and edge-case behavior¶
- No subscriber attached:
OnRuleBroken(rule)andOnRuleNotBroken(rule)throwNullReferenceExceptionbecause they invoke their delegates without a null check; see BR-001. Callers must ensure a listener is subscribed before any rule-evaluation logic can call either method safely. - No input validation: the methods accept
object rulewith no type or null checking, so any payload — including anullreference — is forwarded unchanged to subscribers.
Related documentation¶
Sources¶
SAIF.Framework.Bindable\clsrulesmanagerbase.cs