Skip to content

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

  1. A subclass calls OnRuleBroken(rule) or OnRuleNotBroken(rule) on the current clsRulesManagerBase instance, depending on which state transition it detected.
  2. The method selects the event delegate matching that call: RuleBroken for a broken-state notification, RuleNotBroken for a resolved-state notification.
  3. The method invokes the selected delegate directly with the supplied rule argument, with no null check beforehand (BR-001).
  4. If a subscriber is attached, its handler executes and control returns normally to the caller.
  5. If no subscriber is attached, the direct delegate invocation throws NullReferenceException, and that exception propagates up through OnRuleBroken/OnRuleNotBroken to 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) and OnRuleNotBroken(rule) throw NullReferenceException because 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 rule with no type or null checking, so any payload — including a null reference — is forwarded unchanged to subscribers.

Sources

  • SAIF.Framework.Bindable\clsrulesmanagerbase.cs