---
title: NotificationRule
summary: API reference for NotificationRule.
status: draft
owner: SAIF.Core Documentation Team
last_reviewed: 2026-09-24
library: SAIF.Services.ClaimInfoApi.Core
reference_type: package
---

# NotificationRule

`NotificationRule` is the immutable-by-construction definition of a single metadata-driven rule: which model member (or method) to evaluate, which operator to apply, and what output to produce. Its constructor is private, so [NotificationRuleEngine](NotificationRuleEngine.md) and every caller can only build instances through its four static factory methods ([OP-CIA-04](../../operations-processes.md#operation-catalog)), and [NotificationRuleEngine.CalculateNotification](NotificationRuleEngine.md) mutates the public `_id` field when constructing an out-property child rule so it can share the parent's identity.

## Purpose
- Describe, as data, which model member or method a rule evaluates, which comparison operator applies, and what target/constant value participates in the comparison — resolved entirely by reflection at run time by [BuildExpr](NotificationRuleEngine.md).
- Restrict rule construction to four static factories (`PropertyRule`, `MethodRule`, `EvalRuleOutProperty`, `EvalRuleOutValue`) so every rule is built through one of a small set of well-defined shapes ([OP-CIA-04](../../operations-processes.md#operation-catalog)).
- Carry the conditional-output metadata (`OutProperty`, `OutPropertyTypeName`, `OutValue`) that lets a `bool` rule resolve to a derived property or constant value ([CIA-BR-005](../../business-rules.md#cia-br-005-a-true-bool-rule-with-an-out-property-recurses-into-a-child-property-rule), [CIA-BR-006](../../business-rules.md#cia-br-006-a-true-bool-rule-without-an-out-property-falls-back-to-a-constant-out-value)).

## Context
- Namespace: `SAIF.Services.ClaimInfoApi.Core`
- Assembly/package: `SAIF.Services.ClaimInfoApi.Core.dll`, packaged inside the `SAIF.SAIFCode.Core` NuGet package

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `_id` | `public Guid _id = Guid.NewGuid()` | Public mutable field holding the rule's identity; initialized to a new `Guid` and reassigned by [NotificationRuleEngine.CalculateNotification](NotificationRuleEngine.md) when copying a parent rule's identity onto an out-property child rule ([CIA-BR-005](../../business-rules.md#cia-br-005-a-true-bool-rule-with-an-out-property-recurses-into-a-child-property-rule)). |
| `Position` | `public int Position { get; set; }` | Determines the rule's output key via `Key`; controls which notification result this rule's value overwrites or is overwritten by ([CIA-BR-001](../../business-rules.md#cia-br-001-notification-outputs-are-keyed-by-rule-position), [CIA-BR-007](../../business-rules.md#cia-br-007-only-non-null-results-become-notifications-and-the-last-one-at-a-position-wins)). |
| `Name` | `public string Name { get; set; }` | Caller-supplied descriptive label for the rule; not used in evaluation logic*. |
| `MemberName` | `public string MemberName { get; set; }` | Name of the model property or method that `BuildExpr` resolves by reflection to build the expression body ([CIA-BR-009](../../business-rules.md#cia-br-009-a-matching-public-method-name-invokes-that-method), [CIA-BR-010](../../business-rules.md#cia-br-010-no-operator-means-a-plain-property-read)). |
| `OperatorName` | `public string OperatorName { get; set; }` | Selects the comparison branch: null for a plain property read, an `ExpressionType` name for a binary comparison, or a method name on the property's type otherwise ([CIA-BR-010](../../business-rules.md#cia-br-010-no-operator-means-a-plain-property-read) through [CIA-BR-012](../../business-rules.md#cia-br-012-an-unrecognized-operator-is-treated-as-a-method-on-the-property's-type)). |
| `TargetValue` | `public string TargetValue { get; set; }` | String literal converted to the target member's type and used as the constant/argument in the compiled expression; the literal `"null"` is treated as a null value ([CIA-BR-008](../../business-rules.md#cia-br-008-the-literal-target-value-null-means-a-null-comparison-value)). |
| `TypeName` | `public string TypeName { get; set; }` | Assembly-qualified type name resolved by `Type.GetType` to determine whether the rule evaluates as `int`, `bool`, or string ([CIA-BR-002](../../business-rules.md#cia-br-002-evaluation-type-is-resolved-from-rule-metadata)). |
| `OutProperty` | `public string OutProperty { get; set; }` | When set on a `bool` rule that evaluates true, names the model property whose value becomes the notification, evaluated via a recursive child `PropertyRule` ([CIA-BR-005](../../business-rules.md#cia-br-005-a-true-bool-rule-with-an-out-property-recurses-into-a-child-property-rule)). |
| `OutPropertyTypeName` | `public string OutPropertyTypeName { get; set; }` | Type name for the child `PropertyRule` built from `OutProperty` ([CIA-BR-005](../../business-rules.md#cia-br-005-a-true-bool-rule-with-an-out-property-recurses-into-a-child-property-rule)). |
| `OutValue` | `public string OutValue { get; set; }` | Constant string returned when a `bool` rule evaluates true and `OutProperty` is not set ([CIA-BR-006](../../business-rules.md#cia-br-006-a-true-bool-rule-without-an-out-property-falls-back-to-a-constant-out-value)). |
| `Key` | `public string Key { get; }` | Computed `"{Position}"` string used as the dictionary key for notification results ([CIA-BR-001](../../business-rules.md#cia-br-001-notification-outputs-are-keyed-by-rule-position)). |
| `Id` | `public Guid Id { get; }` | Read-only accessor exposing the current value of `_id`. |
| `Type` | `public Type Type { get; }` | Resolves `TypeName` to a runtime `Type` via `Type.GetType`, driving the evaluation-branch dispatch in [NotificationRuleEngine](NotificationRuleEngine.md) ([CIA-BR-002](../../business-rules.md#cia-br-002-evaluation-type-is-resolved-from-rule-metadata)). |
| `PropertyRule(position, typeName, name, propertyName)` | `public static NotificationRule PropertyRule(int, string, string, string)` | Builds a plain property-read rule with no comparison operator ([CIA-BR-010](../../business-rules.md#cia-br-010-no-operator-means-a-plain-property-read)). |
| `MethodRule(position, name, methodName, parameterValue)` | `public static NotificationRule MethodRule(int, string, string, string)` | Builds a rule that invokes a public method on the model with `TypeName` fixed to `System.Object`, so it is always evaluated through the string branch ([CIA-BR-009](../../business-rules.md#cia-br-009-a-matching-public-method-name-invokes-that-method))*. |
| `EvalRuleOutProperty(position, typeName, name, memberName, operatorName, evalProperty, outProperty, outPropertyTypeName)` | `public static NotificationRule EvalRuleOutProperty(int, string, string, string, string, string, string, string)` | Builds a conditional rule that, when its comparison is true, resolves to another model property's value ([CIA-BR-005](../../business-rules.md#cia-br-005-a-true-bool-rule-with-an-out-property-recurses-into-a-child-property-rule)). |
| `EvalRuleOutValue(position, typeName, name, memberName, operatorName, evalProperty, outValue)` | `public static NotificationRule EvalRuleOutValue(int, string, string, string, string, string, string)` | Builds a conditional rule that, when its comparison is true, resolves to a fixed constant value ([CIA-BR-006](../../business-rules.md#cia-br-006-a-true-bool-rule-without-an-out-property-falls-back-to-a-constant-out-value)). |

## Behavioral notes
- The constructor is private; `PropertyRule`, `MethodRule`, `EvalRuleOutProperty`, and `EvalRuleOutValue` are the only public construction paths. Deserializers that require a public default constructor cannot materialize this type*.
- `_id` is a public mutable field rather than a read-only backing value, which lets [NotificationRuleEngine.CalculateNotification](NotificationRuleEngine.md) reassign it on a freshly built child rule so the child shares the parent's identity for [CIA-BR-005](../../business-rules.md#cia-br-005-a-true-bool-rule-with-an-out-property-recurses-into-a-child-property-rule).
- `MethodRule` sets `TypeName` to `"System.Object"` unconditionally, so a method rule is always dispatched through the string evaluation branch regardless of the method's actual return type; a method that does not return `string` causes a compilation failure in [Compile a rule into a delegate](../../operations/op-cia-03-compile-rule.md)*.

## Constraints and usage notes
- All string properties (`MemberName`, `OperatorName`, `TargetValue`, `TypeName`, `OutProperty`, `OutPropertyTypeName`, `OutValue`) are resolved by reflection or `Type.GetType` at evaluation time; malformed values surface as runtime exceptions rather than construction-time errors.

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts.

## Sources
- `Services/SAIF.Services.ClaimInfoApi.Core/NotificationRule.cs`
