---
title: Build rule definitions
summary: Construct a NotificationRule instance through one of its four static factory methods.
status: draft
owner: SAIF.Core Documentation Team
last_reviewed: 2026-09-24
library: SAIF.Services.ClaimInfoApi.Core
reference_type: package
operation_id: OP-CIA-04
trigger: A caller request
---

# Build rule definitions

`NotificationRule` has only a private constructor, so this operation — its four static factory methods — is the only supported way for a caller to construct a rule definition.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-CIA-04 |
| **Trigger** | A caller request. |
| **Inputs** | Position, type name, member/method name, target value, and (for conditional rules) out-property or out-value data, depending on the factory used. |
| **Outputs** | A `NotificationRule` instance. |
| **Primary components** | `NotificationRule.PropertyRule`, `NotificationRule.MethodRule`, `NotificationRule.EvalRuleOutProperty`, `NotificationRule.EvalRuleOutValue` |
| **Entry point** | `Services/SAIF.Services.ClaimInfoApi.Core/NotificationRule.cs` (lines 43–69) |

## Steps

1. `PropertyRule(position, typeName, name, propertyName)` creates a rule that reads a property of type `typeName` ([CIA-BR-010](../business-rules.md#cia-br-010-no-operator-means-a-plain-property-read)).
2. `MethodRule(position, name, methodName, parameterValue)` creates a rule with `TypeName = "System.Object"` and `TargetValue = parameterValue`, targeting a method call on the model.
   - Because `System.Object` is neither `int` nor `bool`, [Evaluate one rule](op-cia-02-evaluate-one-rule.md) evaluates it through the string branch, so the method must return `string` or compilation fails*. ([CIA-BR-009](../business-rules.md#cia-br-009-a-matching-public-method-name-invokes-that-method))
3. `EvalRuleOutProperty(int position, string typeName, string name, string memberName, string operatorName, string evalProperty, string outProperty, string outPropertyTypeName)` creates a conditional rule that, when true, returns the value of another property (`OutProperty`, typed `OutPropertyTypeName`) ([CIA-BR-005](../business-rules.md#cia-br-005-a-true-bool-rule-with-an-out-property-recurses-into-a-child-property-rule)).
4. `EvalRuleOutValue(int position, string typeName, string name, string memberName, string operatorName, string evalProperty, string outValue)` creates a conditional rule that, when true, returns a constant `OutValue` ([CIA-BR-006](../business-rules.md#cia-br-006-a-true-bool-rule-without-an-out-property-falls-back-to-a-constant-out-value)).
5. All four factories call the private constructor, which sets `Position`, `TypeName`, `Name`, and `MemberName`. `_id` is set to a new `Guid` by the field initializer ([CIA-BR-001](../business-rules.md#cia-br-001-notification-outputs-are-keyed-by-rule-position), [CIA-BR-013](../business-rules.md#cia-br-013-a-matrix-is-identified-by-its-composite-document-type-and-subtype-key)).

## Process flow

The following diagram visualizes the four construction paths, all converging on the private constructor.

```mermaid
flowchart TD
	Start([Caller request]) --> Choice{"Which factory?"}
	Choice -->|PropertyRule| Prop["Set property-read metadata"]
	Choice -->|MethodRule| Method["Set TypeName=System.Object<br>TargetValue=parameterValue"]
	Choice -->|EvalRuleOutProperty| OutProp["Set OutProperty and<br>OutPropertyTypeName"]
	Choice -->|EvalRuleOutValue| OutVal["Set OutValue"]
	Prop --> Ctor["Private constructor:<br>set Position, TypeName,<br>Name, MemberName"]
	Method --> Ctor
	OutProp --> Ctor
	OutVal --> Ctor
	Ctor --> Done(["Return NotificationRule<br>with new Guid _id"])
```

## Failure and edge-case behavior
- `NotificationRule` cannot be constructed by any means other than these four factories, since the constructor is private and there is no parameterless constructor; deserializers requiring a public default constructor cannot materialize it*.
- A `MethodRule` whose target method does not return `string` fails during [Compile a rule into a delegate](op-cia-03-compile-rule.md), not at construction time*.

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

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

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