Table of Contents

Class RuleAction

Namespace
RuleWright.Core
Assembly
RuleWright.Core.dll

An action applied when a rule fires — from its actions when the condition passes, or its else actions when it does not. Most actions write a ValueExpression into the evaluation result's outputs under Target: a constant is simply a LiteralExpression, and a value derived from the fact is a FieldExpression or OperatorExpression. The Type decides how the value combines with what fired rules have already written: setOutput replaces, addToOutput accumulates numerically, appendToOutput collects into a list, and removeOutput deletes the key (ignoring any value).

public sealed class RuleAction
Inheritance
RuleAction
Inherited Members

Constructors

RuleAction(string, string, ValueExpression)

Creates a rule action from a value expression.

RuleAction(string, string, object?)

Creates a rule action that writes a constant scalar, a convenience for the common case (equivalent to passing new LiteralExpression(constant)).

Fields

AddToOutputType

Numerically adds the value to Target (a running total across fired rules); a null value contributes nothing.

AppendToOutputType

Appends the value to a list at Target (collected across fired rules); a null value contributes nothing.

RemoveOutputType

Removes Target from the running outputs, undoing whatever an earlier-fired rule wrote there. Carries no meaningful value.

SetOutputType

Writes the value to Target, replacing any existing value.

Properties

Target

The output key the action writes.

Type

The action type identifier (setOutput).

Value

The value expression evaluated against the fact to produce the output. A constant action carries a LiteralExpression; a removeOutput action carries a null literal that is never read.

Methods

RemoveOutput(string)

Creates a removeOutput action that deletes target from the running outputs. The action carries no value.