Skip to content

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).
  2. MethodRule(position, name, methodName, parameterValue) creates a rule with TypeName = "System.Object" and TargetValue = parameterValue, targeting a method call on the model.
  3. Because System.Object is neither int nor bool, Evaluate one rule evaluates it through the string branch, so the method must return string or compilation fails*. (CIA-BR-009)
  4. 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).
  5. 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).
  6. 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, CIA-BR-013).

Process flow

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

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, 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.

Sources

  • Services/SAIF.Services.ClaimInfoApi.Core/NotificationRule.cs