Skip to content

clsRulesManagerBase

clsRulesManagerBase is an abstract base class that exposes RuleBroken/RuleNotBroken events, implementing a business-rule-violation notification pattern for subclasses elsewhere in the SAIF BOF stack.

Purpose

  • Provide a reusable rule-violation notification mechanism (RuleBroken/RuleNotBroken events) for business object subclasses; contains no concrete rule evaluation or validation logic itself.

Context

  • Namespace: SAIF.Framework
  • Assembly/package: SAIF.BOF.Framework.Bindable.csproj (packed into the SAIF.BOF.Framework NuGet package)*

Public members

Member Signature Purpose
RuleBroken event RuleEvent RuleBroken Serialization-safe ([NonSerialized]) event raised when a subclass reports a business rule has been broken.
RuleNotBroken event RuleEvent RuleNotBroken Serialization-safe ([NonSerialized]) event raised when a subclass reports a previously-broken business rule is resolved.

Behavioral notes

  • The protected OnRuleBroken(object rule) and OnRuleNotBroken(object rule) methods invoke their respective event delegates directly (RuleBroken(rule), RuleNotBroken(rule)) with no null-check guard, so calling either method with zero subscribers throws a NullReferenceException at runtime.* This is the mechanism documented in BR-001.
  • This contrasts with the guarded pattern used in clsBindableBase.OnIsModifiedChanged(), which checks if (IsModifiedChanged != null) before raising its event.
  • No consumers of this class exist within this library's own source; actual subclassing usage is outside this library's scope and unverified.**

Constraints and usage notes

  • Consumers must ensure a subscriber is always attached to RuleBroken/RuleNotBroken before a subclass calls OnRuleBroken/OnRuleNotBroken, or an unhandled NullReferenceException will be thrown. See BR-001.
  • The RuleBroken and RuleNotBroken events are marked [NonSerialized], so they are excluded from binary/XML serialization of the subclass instance.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • SAIF.Framework.Bindable\clsrulesmanagerbase.cs