Interface ILeftHandSideExpression
Rule's left-hand side (conditions) expression builder.
public interface ILeftHandSideExpression
Methods
All<TFact>(Expression<Func<TFact, bool>>)
Defines a pattern that triggers the rule only if all facts of a given type match the condition.
ILeftHandSideExpression All<TFact>(Expression<Func<TFact, bool>> condition)
Parameters
condition
Expression<Func<TFact, bool>>Condition that all facts of a given type must satisfy to trigger the rule.
Returns
- ILeftHandSideExpression
Left hand side expression builder.
Type Parameters
TFact
Type of fact to match.
All<TFact>(Expression<Func<TFact, bool>>, params Expression<Func<TFact, bool>>[])
Defines a pattern that triggers the rule only if all facts that match the base condition also match all the remaining conditions (universal quantifier).
ILeftHandSideExpression All<TFact>(Expression<Func<TFact, bool>> baseCondition, params Expression<Func<TFact, bool>>[] conditions)
Parameters
baseCondition
Expression<Func<TFact, bool>>Base condition that filters the facts to match the remaining conditions.
conditions
Expression<Func<TFact, bool>>[]Set of additional conditions that all matching facts must satisfy to trigger the rule.
Returns
- ILeftHandSideExpression
Left hand side expression builder.
Type Parameters
TFact
Type of fact to match.
And(Action<ILeftHandSideExpression>)
Defines a group of patterns joined by an AND operator. If all of the patterns in the group match then the whole group matches.
ILeftHandSideExpression And(Action<ILeftHandSideExpression> builder)
Parameters
builder
Action<ILeftHandSideExpression>Group expression builder.
Returns
- ILeftHandSideExpression
Left hand side expression builder.
Exists<TFact>(params Expression<Func<TFact, bool>>[])
Defines a pattern that triggers the rule only if there is at least one matching fact (existential quantifier).
ILeftHandSideExpression Exists<TFact>(params Expression<Func<TFact, bool>>[] conditions)
Parameters
conditions
Expression<Func<TFact, bool>>[]Set of conditions the facts must satisfy to trigger the rule.
Returns
- ILeftHandSideExpression
Left hand side expression builder.
Type Parameters
TFact
Type of fact to match.
Having(params Expression<Func<bool>>[])
Adds match conditions to existing rule patterns.
ILeftHandSideExpression Having(params Expression<Func<bool>>[] conditions)
Parameters
conditions
Expression<Func<bool>>[]Additional match conditions.
Returns
- ILeftHandSideExpression
Left hand side expression builder.
Let<TResult>(Expression<Func<TResult>>, Expression<Func<TResult>>)
Binds expression to a variable. Expression can use previously defined rule patterns.
ILeftHandSideExpression Let<TResult>(Expression<Func<TResult>> alias, Expression<Func<TResult>> expression)
Parameters
alias
Expression<Func<TResult>>Alias for the expression.
expression
Expression<Func<TResult>>Expression to bind.
Returns
- ILeftHandSideExpression
Left hand side expression builder.
Type Parameters
TResult
Type of the expression result.
Match<TFact>(params Expression<Func<TFact, bool>>[])
Defines a pattern for facts matching a set of conditions. Does not bind matching fact to a variable. Optionally, enables aggregation of matching facts.
ILeftHandSideExpression Match<TFact>(params Expression<Func<TFact, bool>>[] conditions)
Parameters
conditions
Expression<Func<TFact, bool>>[]Set of additional conditions the fact must satisfy to trigger the rule.
Returns
- ILeftHandSideExpression
Left hand side expression builder.
Type Parameters
TFact
Match<TFact>(Expression<Func<TFact>>, params Expression<Func<TFact, bool>>[])
Defines a pattern for facts matching a set of conditions. Binds matching fact to a variable.
ILeftHandSideExpression Match<TFact>(Expression<Func<TFact>> alias, params Expression<Func<TFact, bool>>[] conditions)
Parameters
alias
Expression<Func<TFact>>Alias for the matching fact.
conditions
Expression<Func<TFact, bool>>[]Set of conditions the fact must satisfy to trigger the rule.
Returns
- ILeftHandSideExpression
Left hand side expression builder.
Type Parameters
TFact
Type of fact to match.
Not<TFact>(params Expression<Func<TFact, bool>>[])
Defines a pattern that triggers the rule only if there are no matching facts (negation quantifier).
ILeftHandSideExpression Not<TFact>(params Expression<Func<TFact, bool>>[] conditions)
Parameters
conditions
Expression<Func<TFact, bool>>[]Set of conditions the facts must not satisfy to trigger the rule.
Returns
- ILeftHandSideExpression
Left hand side expression builder.
Type Parameters
TFact
Type of fact to match.
Or(Action<ILeftHandSideExpression>)
Defines a group of patterns joined by an OR operator. If either of the patterns in the group matches then the whole group matches.
ILeftHandSideExpression Or(Action<ILeftHandSideExpression> builder)
Parameters
builder
Action<ILeftHandSideExpression>Group expression builder.
Returns
- ILeftHandSideExpression
Left hand side expression builder.
Query<TResult>(Expression<Func<TResult>>, Func<IQuery, IQuery<TResult>>)
Queries rules engine for matching facts.
ILeftHandSideExpression Query<TResult>(Expression<Func<TResult>> alias, Func<IQuery, IQuery<TResult>> queryExpression)
Parameters
alias
Expression<Func<TResult>>Alias for the query results.
queryExpression
Func<IQuery, IQuery<TResult>>Query expression.
Returns
- ILeftHandSideExpression
Left hand side expression builder.
Type Parameters
TResult
Query result type.