Class Element
Factory class for rule elements.
public static class Element
- Inheritance
-
Element
- Inherited Members
Methods
Action(LambdaExpression)
Creates an action element that represents an action taken by the engine when the rule fires. The action element is created with the default trigger, which executes the action when rule is Activated or Reactivated.
public static ActionElement Action(LambdaExpression expression)
Parameters
expression
LambdaExpressionAction expression. It must have IContext as it's first parameter.
Returns
- ActionElement
Created element.
Action(LambdaExpression, ActionTrigger)
Creates an action element that represents an action taken by the engine when the rule fires.
public static ActionElement Action(LambdaExpression expression, ActionTrigger actionTrigger)
Parameters
expression
LambdaExpressionAction expression. It must have IContext as it's first parameter.
actionTrigger
ActionTriggerAction trigger that indicates when the action should execute.
Returns
- ActionElement
Created element.
ActionGroup(params ActionElement[])
Creates an action group element.
public static ActionGroupElement ActionGroup(params ActionElement[] actions)
Parameters
actions
ActionElement[]Action elements in the group.
Returns
- ActionGroupElement
Created element.
- See Also
ActionGroup(IEnumerable<ActionElement>)
Creates an action group element.
public static ActionGroupElement ActionGroup(IEnumerable<ActionElement> actions)
Parameters
actions
IEnumerable<ActionElement>Action elements in the group.
Returns
- ActionGroupElement
Created element.
- See Also
Aggregate(Type, string, IEnumerable<NamedExpressionElement>, PatternElement)
Creates an element that represents an aggregation of facts.
public static AggregateElement Aggregate(Type resultType, string name, IEnumerable<NamedExpressionElement> expressions, PatternElement source)
Parameters
resultType
TypeType of the aggregate result.
name
stringAggregate name.
expressions
IEnumerable<NamedExpressionElement>Expressions used to construct aggregates from individual facts.
source
PatternElementPattern that matches facts for aggregation.
Returns
- AggregateElement
Created element.
Aggregate(Type, string, IEnumerable<NamedExpressionElement>, PatternElement, Type?)
Creates an element that represents an aggregation of facts.
public static AggregateElement Aggregate(Type resultType, string name, IEnumerable<NamedExpressionElement> expressions, PatternElement source, Type? customFactoryType)
Parameters
resultType
TypeType of the aggregate result.
name
stringAggregate name.
expressions
IEnumerable<NamedExpressionElement>Expressions used to construct aggregates from individual facts.
source
PatternElementPattern that matches facts for aggregation.
customFactoryType
TypeFactory type used construct aggregators for this aggregation.
Returns
- AggregateElement
Created element.
Aggregate(Type, string, IEnumerable<KeyValuePair<string, LambdaExpression>>, PatternElement)
Creates an element that represents an aggregation of facts.
public static AggregateElement Aggregate(Type resultType, string name, IEnumerable<KeyValuePair<string, LambdaExpression>> expressions, PatternElement source)
Parameters
resultType
TypeType of the aggregate result.
name
stringAggregate name.
expressions
IEnumerable<KeyValuePair<string, LambdaExpression>>Expressions used to construct aggregates from individual facts.
source
PatternElementPattern that matches facts for aggregation.
Returns
- AggregateElement
Created element.
Aggregate(Type, string, IEnumerable<KeyValuePair<string, LambdaExpression>>, PatternElement, Type?)
Creates an element that represents an aggregation of facts.
public static AggregateElement Aggregate(Type resultType, string name, IEnumerable<KeyValuePair<string, LambdaExpression>> expressions, PatternElement source, Type? customFactoryType)
Parameters
resultType
TypeType of the aggregate result.
name
stringAggregate name.
expressions
IEnumerable<KeyValuePair<string, LambdaExpression>>Expressions used to construct aggregates from individual facts.
source
PatternElementPattern that matches facts for aggregation.
customFactoryType
TypeFactory type used construct aggregators for this aggregation.
Returns
- AggregateElement
Created element.
AndGroup(params RuleElement[])
Creates a left-hand side group element that combines contained elements using an AND operator.
public static AndElement AndGroup(params RuleElement[] childElements)
Parameters
childElements
RuleElement[]Child elements contained in the group.
Returns
- AndElement
Created element.
AndGroup(IEnumerable<RuleElement>)
Creates a left-hand side group element that combines contained elements using an AND operator.
public static AndElement AndGroup(IEnumerable<RuleElement> childElements)
Parameters
childElements
IEnumerable<RuleElement>Child elements contained in the group.
Returns
- AndElement
Created element.
Binding(LambdaExpression)
Creates an element that represents results of an expression evaluation.
public static BindingElement Binding(LambdaExpression expression)
Parameters
expression
LambdaExpressionBinding expression.
Returns
- BindingElement
Created element.
Binding(Type?, LambdaExpression)
Creates an element that represents results of an expression evaluation.
public static BindingElement Binding(Type? resultType, LambdaExpression expression)
Parameters
resultType
TypeType of the expression result.
expression
LambdaExpressionBinding expression.
Returns
- BindingElement
Created element.
Collect(PatternElement)
Creates an element that aggregates matching facts into a collection.
public static AggregateElement Collect(PatternElement source)
Parameters
source
PatternElementPattern that matches facts for aggregation.
Returns
- AggregateElement
Created element.
Collect(Type?, PatternElement)
Creates an element that aggregates matching facts into a collection.
public static AggregateElement Collect(Type? resultType, PatternElement source)
Parameters
resultType
TypeType of the aggregate result.
source
PatternElementPattern that matches facts for aggregation.
Returns
- AggregateElement
Created element.
Condition(LambdaExpression)
Creates a condition element that represents a condition applied to elements matched by a pattern.
public static NamedExpressionElement Condition(LambdaExpression expression)
Parameters
expression
LambdaExpressionCondition expression. It must have
Boolean
as its return type.
Returns
- NamedExpressionElement
Created element.
Declaration(Type, string)
Creates a declaration with a given name and type to be used in other rule elements.
public static Declaration Declaration(Type type, string name)
Parameters
Returns
- Declaration
Created declaration.
Dependency(Declaration, Type)
Creates a dependency element.
public static DependencyElement Dependency(Declaration declaration, Type serviceType)
Parameters
declaration
DeclarationDeclaration that references the dependency.
serviceType
TypeType of the service that the dependency represents.
Returns
- DependencyElement
Created element.
Dependency(Type, string)
Creates a dependency element.
public static DependencyElement Dependency(Type type, string name)
Parameters
Returns
- DependencyElement
Created element.
DependencyGroup(params DependencyElement[])
Creates a dependency group element.
public static DependencyGroupElement DependencyGroup(params DependencyElement[] dependencies)
Parameters
dependencies
DependencyElement[]Dependency elements in the group.
Returns
- DependencyGroupElement
Created element.
- See Also
DependencyGroup(IEnumerable<DependencyElement>)
Creates a dependency group element.
public static DependencyGroupElement DependencyGroup(IEnumerable<DependencyElement> dependencies)
Parameters
dependencies
IEnumerable<DependencyElement>Dependency elements in the group.
Returns
- DependencyGroupElement
Created element.
- See Also
Exists(RuleElement)
Creates an element that represents an existential quantifier.
public static ExistsElement Exists(RuleElement source)
Parameters
source
RuleElementSource element to apply the existential quantifier to.
Returns
- ExistsElement
Created element.
Expression(string, LambdaExpression)
Creates a named expression element that can be used by other rule elements.
public static NamedExpressionElement Expression(string name, LambdaExpression expression)
Parameters
name
stringName of the expression.
expression
LambdaExpressionThe actual expression that this element represents.
Returns
- NamedExpressionElement
Created element.
Filter(FilterType, LambdaExpression)
Creates an agenda filter element.
public static FilterElement Filter(FilterType filterType, LambdaExpression expression)
Parameters
filterType
FilterTypeType of agenda filter.
expression
LambdaExpressionFilter expression.
Returns
- FilterElement
Created element.
FilterGroup(params FilterElement[])
Creates an agenda filter group element.
public static FilterGroupElement FilterGroup(params FilterElement[] filters)
Parameters
filters
FilterElement[]Agenda filter elements in the group.
Returns
- FilterGroupElement
Created element.
- See Also
FilterGroup(IEnumerable<FilterElement>)
Creates an agenda filter group element.
public static FilterGroupElement FilterGroup(IEnumerable<FilterElement> filters)
Parameters
filters
IEnumerable<FilterElement>Agenda filter elements in the group.
Returns
- FilterGroupElement
Created element.
- See Also
Flatten(Type, LambdaExpression, PatternElement)
Creates an element that flattens collections of elements from matching facts into a single set of facts.
public static AggregateElement Flatten(Type resultType, LambdaExpression selector, PatternElement source)
Parameters
resultType
TypeType of the aggregate result.
selector
LambdaExpressionExpression that selects a collection of elements from a matching fact.
source
PatternElementPattern that matches facts for aggregation.
Returns
- AggregateElement
Created element.
ForAll(PatternElement, IEnumerable<PatternElement>)
Creates an element that represents a universal quantifier.
Facts that match the basePattern
must also match all other patterns
.
public static ForAllElement ForAll(PatternElement basePattern, IEnumerable<PatternElement> patterns)
Parameters
basePattern
PatternElementBase patterns of the universal quantifier that defines the universe of facts to consider.
patterns
IEnumerable<PatternElement>Additional patterns of the universal quantifier that the fact matched by the base pattern must also satisfy.
Returns
- ForAllElement
Created element.
Group(GroupType, IEnumerable<RuleElement>)
Creates a left-hand side group element, that contains pattern elements and nested group elements.
public static GroupElement Group(GroupType groupType, IEnumerable<RuleElement> childElements)
Parameters
groupType
GroupTypeType of the group element.
childElements
IEnumerable<RuleElement>Child elements contained in the group.
Returns
- GroupElement
Created element.
GroupBy(LambdaExpression, LambdaExpression, PatternElement)
Creates an element that aggregates matching facts into groups.
public static AggregateElement GroupBy(LambdaExpression keySelector, LambdaExpression elementSelector, PatternElement source)
Parameters
keySelector
LambdaExpressionExpression that extracts grouping keys from source element.
elementSelector
LambdaExpressionExpression that extracts elements to put into resulting groups.
source
PatternElementPattern that matches facts for aggregation.
Returns
- AggregateElement
Created element.
GroupBy(Type?, LambdaExpression, LambdaExpression, PatternElement)
Creates an element that aggregates matching facts into groups.
public static AggregateElement GroupBy(Type? resultType, LambdaExpression keySelector, LambdaExpression elementSelector, PatternElement source)
Parameters
resultType
TypeType of the aggregate result.
keySelector
LambdaExpressionExpression that extracts grouping keys from source element.
elementSelector
LambdaExpressionExpression that extracts elements to put into resulting groups.
source
PatternElementPattern that matches facts for aggregation.
Returns
- AggregateElement
Created element.
Not(RuleElement)
Creates an element that represents a negative existential quantifier.
public static NotElement Not(RuleElement source)
Parameters
source
RuleElementSource element to apply the negative existential quantifier to.
Returns
- NotElement
Created element.
OrGroup(params RuleElement[])
Creates a left-hand side group element that combines contained elements using an OR operator.
public static OrElement OrGroup(params RuleElement[] childElements)
Parameters
childElements
RuleElement[]Child elements contained in the group.
Returns
- OrElement
Created element.
OrGroup(IEnumerable<RuleElement>)
Creates a left-hand side group element that combines contained elements using an OR operator.
public static OrElement OrGroup(IEnumerable<RuleElement> childElements)
Parameters
childElements
IEnumerable<RuleElement>Child elements contained in the group.
Returns
- OrElement
Created element.
Pattern(Declaration, IEnumerable<NamedExpressionElement>, RuleElement?)
Creates a pattern element that represents a match over results of the source element.
public static PatternElement Pattern(Declaration declaration, IEnumerable<NamedExpressionElement> expressions, RuleElement? source)
Parameters
declaration
DeclarationDeclaration that references the pattern.
expressions
IEnumerable<NamedExpressionElement>Expressions used by the pattern to match elements.
source
RuleElementSource of the elements matched by the pattern. If it's
null
, the pattern matches facts in rules engine's working memory.
Returns
- PatternElement
Created element.
Pattern(Declaration, IEnumerable<KeyValuePair<string, LambdaExpression>>)
Creates a pattern element that represents a match of facts in rules engine's working memory.
public static PatternElement Pattern(Declaration declaration, IEnumerable<KeyValuePair<string, LambdaExpression>> expressions)
Parameters
declaration
DeclarationDeclaration that references the pattern.
expressions
IEnumerable<KeyValuePair<string, LambdaExpression>>Expressions used by the pattern to match elements.
Returns
- PatternElement
Created element.
Pattern(Declaration, IEnumerable<KeyValuePair<string, LambdaExpression>>, RuleElement?)
Creates a pattern element that represents a match over results of the source element.
public static PatternElement Pattern(Declaration declaration, IEnumerable<KeyValuePair<string, LambdaExpression>> expressions, RuleElement? source)
Parameters
declaration
DeclarationDeclaration that references the pattern.
expressions
IEnumerable<KeyValuePair<string, LambdaExpression>>Expressions used by the pattern to match elements.
source
RuleElementSource of the elements matched by the pattern. If it's
null
, the pattern matches facts in rules engine's working memory.
Returns
- PatternElement
Created element.
Pattern(Type, string, IEnumerable<NamedExpressionElement>, RuleElement?)
Creates a pattern element that represents a match over results of the source element.
public static PatternElement Pattern(Type type, string name, IEnumerable<NamedExpressionElement> expressions, RuleElement? source)
Parameters
type
TypeType of elements matched by the pattern.
name
stringPattern name.
expressions
IEnumerable<NamedExpressionElement>Expressions used by the pattern to match elements.
source
RuleElementSource of the elements matched by the pattern. If it's
null
, the pattern matches facts in rules engine's working memory.
Returns
- PatternElement
Created element.
Pattern(Type, string, IEnumerable<KeyValuePair<string, LambdaExpression>>)
Creates a pattern element that represents a match of facts in rules engine's working memory.
public static PatternElement Pattern(Type type, string name, IEnumerable<KeyValuePair<string, LambdaExpression>> expressions)
Parameters
type
TypeType of facts matched by the pattern.
name
stringPattern name.
expressions
IEnumerable<KeyValuePair<string, LambdaExpression>>Expressions used by the pattern to match elements.
Returns
- PatternElement
Created element.
Pattern(Type, string, IEnumerable<KeyValuePair<string, LambdaExpression>>, RuleElement?)
Creates a pattern element that represents a match over results of the source element.
public static PatternElement Pattern(Type type, string name, IEnumerable<KeyValuePair<string, LambdaExpression>> expressions, RuleElement? source)
Parameters
type
TypeType of elements matched by the pattern.
name
stringPattern name.
expressions
IEnumerable<KeyValuePair<string, LambdaExpression>>Expressions used by the pattern to match elements.
source
RuleElementSource of the elements matched by the pattern. If it's
null
, the pattern matches facts in rules engine's working memory.
Returns
- PatternElement
Created element.
Project(LambdaExpression, PatternElement)
Creates an element that projects matching facts into different elements.
public static AggregateElement Project(LambdaExpression selector, PatternElement source)
Parameters
selector
LambdaExpressionExpression that translates a matching element into a different element.
source
PatternElementPattern that matches facts for aggregation.
Returns
- AggregateElement
Created element.
Project(Type?, LambdaExpression, PatternElement)
Creates an element that projects matching facts into different elements.
public static AggregateElement Project(Type? resultType, LambdaExpression selector, PatternElement source)
Parameters
resultType
TypeType of the aggregate result.
selector
LambdaExpressionExpression that translates a matching element into a different element.
source
PatternElementPattern that matches facts for aggregation.
Returns
- AggregateElement
Created element.
RuleDefinition(string, string, int, GroupElement, ActionGroupElement)
Creates a rule definition.
public static IRuleDefinition RuleDefinition(string name, string description, int priority, GroupElement leftHandSide, ActionGroupElement rightHandSide)
Parameters
name
stringRule's name.
description
stringRule's description.
priority
intRule's priority.
leftHandSide
GroupElementRule's left-hand side top group element.
rightHandSide
ActionGroupElementRule's right-hand side group element.
Returns
- IRuleDefinition
Created rule definition.
RuleDefinition(string, string, int, RuleRepeatability, IEnumerable<string>, IEnumerable<RuleProperty>, DependencyGroupElement, GroupElement, FilterGroupElement, ActionGroupElement)
Creates a rule definition.
public static IRuleDefinition RuleDefinition(string name, string description, int priority, RuleRepeatability repeatability, IEnumerable<string> tags, IEnumerable<RuleProperty> properties, DependencyGroupElement dependencies, GroupElement leftHandSide, FilterGroupElement filters, ActionGroupElement rightHandSide)
Parameters
name
stringRule's name.
description
stringRule's description.
priority
intRule's priority.
repeatability
RuleRepeatabilityRule's repeatability.
tags
IEnumerable<string>Tags associated with the rule.
properties
IEnumerable<RuleProperty>Properties associated with the rule.
dependencies
DependencyGroupElementRule's dependency group element.
leftHandSide
GroupElementRule's left-hand side top group element.
filters
FilterGroupElementRule's filter group element.
rightHandSide
ActionGroupElementRule's right-hand side group element.
Returns
- IRuleDefinition
Created rule definition.
RuleDefinition(string, string, int, IEnumerable<string>, GroupElement, ActionGroupElement)
Creates a rule definition.
public static IRuleDefinition RuleDefinition(string name, string description, int priority, IEnumerable<string> tags, GroupElement leftHandSide, ActionGroupElement rightHandSide)
Parameters
name
stringRule's name.
description
stringRule's description.
priority
intRule's priority.
tags
IEnumerable<string>Tags associated with the rule.
leftHandSide
GroupElementRule's left-hand side top group element.
rightHandSide
ActionGroupElementRule's right-hand side group element.
Returns
- IRuleDefinition
Created rule definition.