Table of Contents

Method RegisterFunction

Namespace
RuleWright.Execution
Assembly
RuleWright.Execution.dll

RegisterFunction(string, Func<object?, object?, bool>)

Registers a custom condition function referenced from JSON as { "operator": "custom", "name": "..." }. The delegate receives the resolved field value (or the whole fact when the leaf has no field) and the leaf's constant value. It is bound into compiled rules at compile time and must be thread-safe.

public RuleWrightBuilder RegisterFunction(string name, Func<object?, object?, bool> function)

Parameters

name string

The case-sensitive function name used in rule JSON.

function Func<object, object, bool>

The condition implementation.

Returns

RuleWrightBuilder

Exceptions

ArgumentException

name is null/empty or already registered.

ArgumentNullException

function is null.

RegisterFunction(IRuleFunction)

Registers a custom condition function implementation under its Name.

public RuleWrightBuilder RegisterFunction(IRuleFunction function)

Parameters

function IRuleFunction

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.