Table of Contents

Class AggregateBuilder

Namespace
NRules.RuleModel.Builders
Assembly
NRules.RuleModel.dll

Builder to compose an aggregate element.

public class AggregateBuilder : RuleElementBuilder
Inheritance
AggregateBuilder
Inherited Members

Constructors

AggregateBuilder()

Initializes a new instance of the AggregateBuilder.

public AggregateBuilder()

Methods

Aggregator(string, IEnumerable<KeyValuePair<string, LambdaExpression>>, Type)

Configure a custom aggregator.

public void Aggregator(string name, IEnumerable<KeyValuePair<string, LambdaExpression>> expressions, Type customFactoryType = null)

Parameters

name string

Name of the aggregator.

expressions IEnumerable<KeyValuePair<string, LambdaExpression>>

Named expressions used by the aggregator.

customFactoryType Type

The type of the custom aggregate factory

Collect()

Configure a collection aggregator.

public void Collect()

Flatten(LambdaExpression)

Configure flattening aggregator.

public void Flatten(LambdaExpression selector)

Parameters

selector LambdaExpression

Projection expression.

GroupBy(LambdaExpression, LambdaExpression)

Configure group by aggregator.

public void GroupBy(LambdaExpression keySelector, LambdaExpression elementSelector)

Parameters

keySelector LambdaExpression

Grouping key selection expressions.

elementSelector LambdaExpression

Element selection expression.

OrderBy(LambdaExpression, SortDirection)

Configure Collect() aggregator to order facts by key.

public void OrderBy(LambdaExpression keySelector, SortDirection sortDirection)

Parameters

keySelector LambdaExpression

Key selection expression.

sortDirection SortDirection

Order to sort the aggregation in.

Pattern(PatternBuilder)

Sets a pattern builder as the source of the aggregate element.

public void Pattern(PatternBuilder builder)

Parameters

builder PatternBuilder

Element builder to set as the source.

Pattern(Declaration)

Creates a pattern builder that builds the source of the aggregate element.

public PatternBuilder Pattern(Declaration declaration)

Parameters

declaration Declaration

Pattern declaration.

Returns

PatternBuilder

Pattern builder.

Pattern(PatternElement)

Creates a pattern builder that builds the source of the aggregate. Sets a pattern element as the source of the aggregate element.

public void Pattern(PatternElement element)

Parameters

element PatternElement

Element to set as the source.

Pattern(Type, string)

Creates a pattern builder that builds the source of the aggregate element.

public PatternBuilder Pattern(Type type, string name = null)

Parameters

type Type

Type of the element the pattern matches.

name string

Pattern name (optional).

Returns

PatternBuilder

Pattern builder.

Project(LambdaExpression)

Configure projection aggregator.

public void Project(LambdaExpression selector)

Parameters

selector LambdaExpression

Projection expression.

ResultType(Type)

Sets type of the result produced by the aggregation.

public void ResultType(Type resultType)

Parameters

resultType Type

Type of the result.

ToLookup(LambdaExpression, LambdaExpression)

Configure Collect() aggregator to arrange facts into a lookup, grouped by key.

public void ToLookup(LambdaExpression keySelector, LambdaExpression elementSelector)

Parameters

keySelector LambdaExpression

Grouping key selection expressions.

elementSelector LambdaExpression

Element selection expression.