Table of Contents

Method RegisterValueFunction

Namespace
RuleWright.Execution
Assembly
RuleWright.Execution.dll

RegisterValueFunction(string, Func<object?[], object?>)

Registers a custom value function referenced from a value expression as { "call": "...", "operands": [...] }. The delegate receives the evaluated operand values in document order. It is bound into compiled rules at compile time, must be thread-safe, and should be total — return null for argument shapes it does not understand, like the built-in expression operators do.

public RuleWrightBuilder RegisterValueFunction(string name, Func<object?[], object?> function)

Parameters

name string

The case-sensitive function name used in rule JSON.

function Func<object[], object>

The value implementation.

Returns

RuleWrightBuilder

Exceptions

ArgumentException

name is null/empty or already registered.

ArgumentNullException

function is null.

RegisterValueFunction(IRuleValueFunction)

Registers a custom value function implementation under its Name. A function that also implements IRuleValueFunctionMetadata with a RequiredOperandCount gets its calls arity-checked at LoadRuleSet.

public RuleWrightBuilder RegisterValueFunction(IRuleValueFunction function)

Parameters

function IRuleValueFunction

The function; must expose a non-empty name and be thread-safe.

Returns

RuleWrightBuilder

Exceptions

ArgumentNullException

function is null.

ArgumentException

The function's name is null/empty or already registered.