Table of Contents

Class RuleCompiler

Namespace
NRules
Assembly
NRules.dll

Compiles rules in a canonical rule model form into an executable representation.

public class RuleCompiler
Inheritance
RuleCompiler
Inherited Members

Constructors

RuleCompiler()

Initializes a new instance of the RuleCompiler class using the default RuleCompilerOptions.

public RuleCompiler()

RuleCompiler(RuleCompilerOptions)

Initializes a new instance of the RuleCompiler class using the specified RuleCompilerOptions.

public RuleCompiler(RuleCompilerOptions options)

Parameters

options RuleCompilerOptions

Properties

AggregatorRegistry

Registry of custom aggregator factories.

public AggregatorRegistry AggregatorRegistry { get; }

Property Value

AggregatorRegistry

ExpressionCompiler

Compiles expressions used in rules conditions and actions into executable delegates. Default implementation uses the built-in .NET expression compiler.

public IExpressionCompiler ExpressionCompiler { get; set; }

Property Value

IExpressionCompiler

Methods

Compile(IEnumerable<IRuleDefinition>)

Compiles a collection of rules into a session factory.

public ISessionFactory Compile(IEnumerable<IRuleDefinition> ruleDefinitions)

Parameters

ruleDefinitions IEnumerable<IRuleDefinition>

Rules to compile.

Returns

ISessionFactory

Session factory.

Exceptions

RuleCompilationException

Any fatal error during rules compilation.

See Also

Compile(IEnumerable<IRuleDefinition>, CancellationToken)

Compiles a collection of rules into a session factory.

public ISessionFactory Compile(IEnumerable<IRuleDefinition> ruleDefinitions, CancellationToken cancellationToken)

Parameters

ruleDefinitions IEnumerable<IRuleDefinition>

Rules to compile.

cancellationToken CancellationToken

Enables cooperative cancellation of the rules compilation.

Returns

ISessionFactory

Session factory.

Exceptions

RuleCompilationException

Any fatal error during rules compilation.

See Also

Compile(IEnumerable<IRuleSet>)

Compiles rules from rule sets into a session factory.

public ISessionFactory Compile(IEnumerable<IRuleSet> ruleSets)

Parameters

ruleSets IEnumerable<IRuleSet>

Rule sets to compile.

Returns

ISessionFactory

Session factory.

Exceptions

RuleCompilationException

Any fatal error during rules compilation.

Compile(IEnumerable<IRuleSet>, CancellationToken)

Compiles rules from rule sets into a session factory.

public ISessionFactory Compile(IEnumerable<IRuleSet> ruleSets, CancellationToken cancellationToken)

Parameters

ruleSets IEnumerable<IRuleSet>

Rule sets to compile.

cancellationToken CancellationToken

Enables cooperative cancellation of the rules compilation.

Returns

ISessionFactory

Session factory.

Exceptions

RuleCompilationException

Any fatal error during rules compilation.