---
title: Evaluate business object rules
summary: Executes registered rules, refreshes broken-rule collections, and exposes validation results to callers and UI consumers.
status: draft
owner: SAIF
last_reviewed: 2026-07-30
library: SAIF.Framework.Core
reference_type: package
operation_id: OP-CORE-002
trigger: Caller invokes IsValid or CheckRules on a business object or collection.
---

# Evaluate business object rules

This operation is the framework's validation pipeline behind `IsValid`, `CheckRules`, and `IDataErrorInfo`. It clears stale rule failures for the identifier being checked, runs registered rules in strict severity order — errors before warnings before informational rules — stopping error escalation as soon as one level fails, and leaves the resulting broken-rule state available to both calling code and UI data-binding consumers.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-CORE-002 |
| **Trigger** | Caller invokes `IsValid` or a business object/collection calls `CheckRules([ruleIdentifier])`. |
| **Inputs** | Business object or collection instance and an optional property/group rule identifier. |
| **Outputs** | Boolean validity plus refreshed broken-rule, warning, and informational state. |
| **Primary components** | `clsBusinessBase.IsValid`, `clsBusinessBase.CheckRules`, `clsBusinessCollectionBase.IsValid`, `clsBusinessCollectionBase.CheckRules`, `clsRulesManager.CheckRules` |
| **Entry point** | `SAIF.Framework.Core\V1\BaseItems\clsBusinessBase.vb` |

## Steps

1. Start validation from `IsValid` or `CheckRules`.
   - `clsBusinessBase.IsValid` clears previously propagated rules and calls `CheckRules()` ([BR-001](../business-rules.md#br-001-rule-registration-and-enforcement-framework), [BR-002](../business-rules.md#br-002-broken-rule-tracking-and-surfacing)).
   - `clsBusinessCollectionBase.IsValid` validates child objects first and can stop after the first invalid child when `ValidateAllChildren = False` ([BR-001](../business-rules.md#br-001-rule-registration-and-enforcement-framework), [BR-002](../business-rules.md#br-002-broken-rule-tracking-and-surfacing)).
2. Apply the deleted-object branch before running object rules.
   - If a business object is marked deleted and `ValidateOnDelete = False`, `clsBusinessBase.CheckRules` clears broken rules and skips execution entirely ([BR-001](../business-rules.md#br-001-rule-registration-and-enforcement-framework)).
   - Otherwise it forwards the request to `Rules.CheckRules(Me, identifier)` ([BR-001](../business-rules.md#br-001-rule-registration-and-enforcement-framework)).
3. Reset stale failures for the requested rule identifier in the rules manager.
   - `clsRulesManager.CheckRules` clears previously recorded failures for the requested property/group before re-evaluating that identifier ([BR-001](../business-rules.md#br-001-rule-registration-and-enforcement-framework), [BR-002](../business-rules.md#br-002-broken-rule-tracking-and-surfacing)).
4. Execute error rules in ordered levels.
   - Level 1 rules run first; level 2 rules run only if level 1 produced no failure; level 3 rules run only if level 2 also passed ([BR-001](../business-rules.md#br-001-rule-registration-and-enforcement-framework)).
   - Each rule delegate is invoked through `ProcessRule`, which turns a failed result into a `clsBrokenRule` entry ([BR-001](../business-rules.md#br-001-rule-registration-and-enforcement-framework), [BR-002](../business-rules.md#br-002-broken-rule-tracking-and-surfacing)).
5. Execute non-error rules only after all error levels pass.
   - Warning rules run next.
   - Informational rules run after warnings ([BR-001](../business-rules.md#br-001-rule-registration-and-enforcement-framework)).
6. Propagate child messages when the target is a collection or when helper validation is used.
   - `clsBusinessCollectionBase.CheckRules` calls `PropagateChildMessages()` so children with `Rules.PropagateMessages = True` contribute failures to the collection ([BR-002](../business-rules.md#br-002-broken-rule-tracking-and-surfacing)).
   - `ValidateChildObject()` and `ValidateChildObjects()` also re-run child validation and propagate failures back to the parent ([BR-002](../business-rules.md#br-002-broken-rule-tracking-and-surfacing)).
7. Surface the refreshed validation state to consumers.
   - `IDataErrorInfo.Error` returns the concatenated object-level error text ([BR-002](../business-rules.md#br-002-broken-rule-tracking-and-surfacing)).
   - `IDataErrorInfo.Item(columnName)` returns property-specific error text, and the count/message properties expose error, warning, and informational summaries ([BR-002](../business-rules.md#br-002-broken-rule-tracking-and-surfacing)).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([IsValid or CheckRules]) --> Delete{Deleted and<br>ValidateOnDelete = False?}
	Delete -->|Yes| Clear[Clear broken rules]
	Delete -->|No| L1[Run level 1 rules]
	L1 --> Pass1{Passed?}
	Pass1 -->|No| Surface[Expose broken rules]
	Pass1 -->|Yes| L2[Run level 2 rules]
	L2 --> Pass2{Passed?}
	Pass2 -->|No| Surface
	Pass2 -->|Yes| L3[Run level 3 rules]
	L3 --> Pass3{Passed?}
	Pass3 -->|No| Surface
	Pass3 -->|Yes| Info[Run warning and informational rules]
	Clear --> Surface
	Info --> Surface
	Surface --> EndOk([Return validity state])
```

## Failure and edge-case behavior

- A deleted business object can intentionally skip validation entirely when `ValidateOnDelete` is disabled — this is a deliberate shortcut, not an omission, so a deleted-and-invalid object will still report as valid in that configuration.
- A collection can stop validating remaining children as soon as the first invalid child is found when `ValidateAllChildren = False`, so a `True` collection result in that mode does not guarantee every child was actually checked.
- Re-checking one rule identifier clears only the prior failures recorded for that identifier before re-evaluating it, so stale broken-rule entries for other identifiers are left untouched.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- SAIF.Framework.Core\V1\BaseItems\clsBusinessBase.vb
- SAIF.Framework.Core\V1\BaseItems\clsBusinessCollectionBase.vb
- SAIF.Framework.Core\V1\BusinessRules\clsRulesManager.vb
