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
expressionLambdaExpressionAction 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
expressionLambdaExpressionAction expression. It must have IContext as it's first parameter.
actionTriggerActionTriggerAction 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
actionsActionElement[]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
actionsIEnumerable<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
resultTypeTypeType of the aggregate result.
namestringAggregate name.
expressionsIEnumerable<NamedExpressionElement>Expressions used to construct aggregates from individual facts.
sourcePatternElementPattern 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
resultTypeTypeType of the aggregate result.
namestringAggregate name.
expressionsIEnumerable<NamedExpressionElement>Expressions used to construct aggregates from individual facts.
sourcePatternElementPattern that matches facts for aggregation.
customFactoryTypeTypeFactory 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
resultTypeTypeType of the aggregate result.
namestringAggregate name.
expressionsIEnumerable<KeyValuePair<string, LambdaExpression>>Expressions used to construct aggregates from individual facts.
sourcePatternElementPattern 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
resultTypeTypeType of the aggregate result.
namestringAggregate name.
expressionsIEnumerable<KeyValuePair<string, LambdaExpression>>Expressions used to construct aggregates from individual facts.
sourcePatternElementPattern that matches facts for aggregation.
customFactoryTypeTypeFactory 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
childElementsRuleElement[]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
childElementsIEnumerable<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
expressionLambdaExpressionBinding 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
resultTypeTypeType of the expression result.
expressionLambdaExpressionBinding expression.
Returns
- BindingElement
Created element.
Collect(PatternElement)
Creates an element that aggregates matching facts into a collection.
public static AggregateElement Collect(PatternElement source)
Parameters
sourcePatternElementPattern 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
resultTypeTypeType of the aggregate result.
sourcePatternElementPattern 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
expressionLambdaExpressionCondition expression. It must have
Booleanas 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
declarationDeclarationDeclaration that references the dependency.
serviceTypeTypeType 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
dependenciesDependencyElement[]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
dependenciesIEnumerable<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
sourceRuleElementSource 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
namestringName of the expression.
expressionLambdaExpressionThe 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
filterTypeFilterTypeType of agenda filter.
expressionLambdaExpressionFilter expression.
Returns
- FilterElement
Created element.
FilterGroup(params FilterElement[])
Creates an agenda filter group element.
public static FilterGroupElement FilterGroup(params FilterElement[] filters)
Parameters
filtersFilterElement[]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
filtersIEnumerable<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
resultTypeTypeType of the aggregate result.
selectorLambdaExpressionExpression that selects a collection of elements from a matching fact.
sourcePatternElementPattern 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
basePatternPatternElementBase patterns of the universal quantifier that defines the universe of facts to consider.
patternsIEnumerable<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
groupTypeGroupTypeType of the group element.
childElementsIEnumerable<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
keySelectorLambdaExpressionExpression that extracts grouping keys from source element.
elementSelectorLambdaExpressionExpression that extracts elements to put into resulting groups.
sourcePatternElementPattern 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
resultTypeTypeType of the aggregate result.
keySelectorLambdaExpressionExpression that extracts grouping keys from source element.
elementSelectorLambdaExpressionExpression that extracts elements to put into resulting groups.
sourcePatternElementPattern 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
sourceRuleElementSource 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
childElementsRuleElement[]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
childElementsIEnumerable<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
declarationDeclarationDeclaration that references the pattern.
expressionsIEnumerable<NamedExpressionElement>Expressions used by the pattern to match elements.
sourceRuleElementSource 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
declarationDeclarationDeclaration that references the pattern.
expressionsIEnumerable<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
declarationDeclarationDeclaration that references the pattern.
expressionsIEnumerable<KeyValuePair<string, LambdaExpression>>Expressions used by the pattern to match elements.
sourceRuleElementSource 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
typeTypeType of elements matched by the pattern.
namestringPattern name.
expressionsIEnumerable<NamedExpressionElement>Expressions used by the pattern to match elements.
sourceRuleElementSource 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
typeTypeType of facts matched by the pattern.
namestringPattern name.
expressionsIEnumerable<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
typeTypeType of elements matched by the pattern.
namestringPattern name.
expressionsIEnumerable<KeyValuePair<string, LambdaExpression>>Expressions used by the pattern to match elements.
sourceRuleElementSource 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
selectorLambdaExpressionExpression that translates a matching element into a different element.
sourcePatternElementPattern 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
resultTypeTypeType of the aggregate result.
selectorLambdaExpressionExpression that translates a matching element into a different element.
sourcePatternElementPattern 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
namestringRule's name.
descriptionstringRule's description.
priorityintRule's priority.
leftHandSideGroupElementRule's left-hand side top group element.
rightHandSideActionGroupElementRule'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
namestringRule's name.
descriptionstringRule's description.
priorityintRule's priority.
repeatabilityRuleRepeatabilityRule's repeatability.
tagsIEnumerable<string>Tags associated with the rule.
propertiesIEnumerable<RuleProperty>Properties associated with the rule.
dependenciesDependencyGroupElementRule's dependency group element.
leftHandSideGroupElementRule's left-hand side top group element.
filtersFilterGroupElementRule's filter group element.
rightHandSideActionGroupElementRule'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
namestringRule's name.
descriptionstringRule's description.
priorityintRule's priority.
tagsIEnumerable<string>Tags associated with the rule.
leftHandSideGroupElementRule's left-hand side top group element.
rightHandSideActionGroupElementRule's right-hand side group element.
Returns
- IRuleDefinition
Created rule definition.