Table of Contents

Class BasePredicate

Namespace
Breeze.Core
Assembly
Breeze.Core.dll

A where clause, in the tree the query parser builds from the JSON a client sends.

public abstract class BasePredicate
Inheritance
BasePredicate
Derived
Inherited Members

Remarks

A predicate is built first and checked afterwards: Validate(Type) resolves its property paths against the entity type, and must run before ToExpression(ParameterExpression) or ToLambda(Type) can build anything.

Constructors

BasePredicate(Operator)

Create a predicate for an operator.

public BasePredicate(Operator op)

Parameters

op Operator

The operator being applied.

Fields

_op

The operator this predicate applies; exposed by Operator.

protected Operator _op

Field Value

Operator

Properties

Operator

The operator this predicate applies.

public Operator Operator { get; }

Property Value

Operator

Methods

PredicateFromMap(IDictionary<string, object?>?)

public static BasePredicate? PredicateFromMap(IDictionary<string, object?>? sourceMap)

Parameters

sourceMap IDictionary<string, object>

Returns

BasePredicate

null if the map is null or empty

PredicatesFromMap(IDictionary<string, object?>)

Build one predicate per entry of a parsed where clause.

public static List<BasePredicate> PredicatesFromMap(IDictionary<string, object?> map)

Parameters

map IDictionary<string, object>

The where clause as parsed from JSON - property names, or operator names, to values.

Returns

List<BasePredicate>

One predicate per entry, to be combined with and.

Exceptions

Exception

An entry uses an operator that is not valid in that position, or a value that cannot be resolved.

ToExpression(ParameterExpression)

Build the boolean expression for this predicate. Validate(Type) must have run first.

public abstract Expression ToExpression(ParameterExpression paramExpr)

Parameters

paramExpr ParameterExpression

The query's lambda parameter.

Returns

Expression

An expression of type bool.

ToLambda(Type)

Build this predicate as a lambda over the entity type, ready to pass to Queryable.Where.

public LambdaExpression ToLambda(Type entityType)

Parameters

entityType Type

The type the query returns.

Returns

LambdaExpression

A lambda of the form ent => <predicate>.

Validate(Type)

Resolve this predicate's property paths against the entity type being queried.

public abstract void Validate(Type entityType)

Parameters

entityType Type

The type the query returns.

Remarks

Exceptions

Exception

A path does not resolve, or an operand is not valid for the operator.