Class BinaryPredicate
A where clause comparing two operands - a property against a literal, or a property against another property.
public class BinaryPredicate : BasePredicate
- Inheritance
-
BinaryPredicate
- Inherited Members
Remarks
Validate(Type) does the work of deciding what each side is, including coercing literals to the property's type and handling enums and 'in' lists.
Constructors
BinaryPredicate(Operator, object, object?)
Compare two operands with an operator.
public BinaryPredicate(Operator op, object expr1Source, object? expr2Source)
Parameters
opOperatorThe comparison to apply.
expr1SourceobjectThe left-hand operand.
expr2SourceobjectThe right-hand operand; null compares against null.
Properties
Expr1Source
The left-hand operand as the client wrote it - a property path, or a function call.
public object Expr1Source { get; }
Property Value
Expr2Source
The right-hand operand as the client wrote it - a literal, a property path, or an array for 'in'.
public object? Expr2Source { get; }
Property Value
Methods
ToExpression(ParameterExpression)
Build the comparison, inserting the nullable conversions the two sides need to be comparable.
public override Expression ToExpression(ParameterExpression paramExpr)
Parameters
paramExprParameterExpressionThe query's lambda parameter.
Returns
- Expression
An expression of type bool.
Validate(Type)
Resolve both operands against the entity type, coercing the right-hand side to the left's type.
public override void Validate(Type entityType)
Parameters
entityTypeTypeThe type the query returns.
Exceptions
- Exception
The left operand is null or unresolvable, or 'in' was given a right-hand operand that is not an array.