Table of Contents

Class Rule

Namespace
NRules.Fluent.Dsl
Assembly
NRules.Fluent.dll

Base class for inline rule definitions. To create a rule using internal DSL, create a class that inherits from NRules.Fluent.Dsl.Rule and override Define() method. Use When() and Then() methods to define rule's conditions and actions correspondingly. A rule can also be decorated with attributes to add relevant metadata: NameAttribute, DescriptionAttribute, TagAttribute, PriorityAttribute, RepeatabilityAttribute.

public abstract class Rule
Inheritance
Rule
Inherited Members

Constructors

Rule()

protected Rule()

Methods

Define()

Method called by the rules engine to define the rule.

public abstract void Define()

Dependency()

Returns expression builder for rule's dependencies.

protected IDependencyExpression Dependency()

Returns

IDependencyExpression

Dependencies expression builder.

Filter()

Returns expression builder for rule's filters.

protected IFilterExpression Filter()

Returns

IFilterExpression

Filters expression builder.

Name(string)

Sets rule's name. Name value set at this level overrides the values specified via NameAttribute attribute.

protected void Name(string value)

Parameters

value string

Rule name value.

Priority(int)

Sets rule's priority. Priority value set at this level overrides the value specified via PriorityAttribute attribute.

protected void Priority(int value)

Parameters

value int

Priority value.

Then()

Returns expression builder for rule's right-hand side (actions).

protected IRightHandSideExpression Then()

Returns

IRightHandSideExpression

Right hand side expression builder.

When()

Returns expression builder for rule's left-hand side (conditions).

protected ILeftHandSideExpression When()

Returns

ILeftHandSideExpression

Left hand side expression builder.