Home RuleRegistry Class
RuleRegistry Class
Cancel

RuleRegistry Class

Namespace: Json.Logic

Inheritance: RuleRegistry 🡒 object

Catalogs all of the known rules.

Methods

AddRule()

Registers a new rule type.

Declaration

1
public static void AddRule()

Remarks

Rules must contain a parameterless constructor.

Decorate your rule type with one or more Json.Logic.OperatorAttributes to define its identifier.

Registering a rule with an identifier that already exists will overwrite the existing registration.

AddRule(JsonSerializerContext typeContext)

Registers a new rule type.

Declaration

1
public static void AddRule(JsonSerializerContext typeContext)

Remarks

Rules must contain a parameterless constructor.

Decorate your rule type with one or more Json.Logic.OperatorAttributes to define its identifier.

Registering a rule with an identifier that already exists will overwrite the existing registration.

AddRule(string op, IRule rule)

Adds a custom Json.Logic.IRule implementation.

Declaration

1
public static void AddRule(string op, IRule rule)
ParameterTypeDescription
opstringThe operator that the rule handles.
ruleIRuleThe rule implementation.

GetHandler(string op)

Gets an Json.Logic.IRule handler for model-less rule evaluation.

Declaration

1
public static IRule GetHandler(string op)
ParameterTypeDescription
opstringThe operator that the rule handles.

Returns

The handler implementation.

GetRule(string identifier)

Gets a Json.Logic.Rule implementation for a given identifier string.

Declaration

1
public static Type GetRule(string identifier)
ParameterTypeDescription
identifierstringThe identifier.

Returns

The System.Type of the rule.

Contents