ConstantValue Class
A constant value operand in criteria expressions.
Namespace: DevExpress.Data.Filtering
Assembly: DevExpress.Data.v24.2.dll
Declaration
Related API Members
The following members return ConstantValue objects:
Remarks
Criteria value operands (OperandValue objects) are automatically passed as standard parameters to the resulting SQL queries, generated based on criteria expressions. The ConstantValue allows you to embed in-line parameters into the resulting SQL queries. With in-line parameters, you can improve performance when executing several SQL queries with matching constants passed as parameters. To accomplish this, replace OperandValue with ConstantValue in your criteria expression as shown below.
Examples
CriteriaOperator filter = new BinaryOperator(new OperandProperty("LastName"),
new ConstantValue("Smith"), BinaryOperatorType.Equal);
The CriteriaOperator.Parse method automatically translates constant operand values to ConstantValue counterparts. So, the following line produces the same criteria.
If you pass constant operand values using positional parameters (see the corresponding section in Criteria Language Syntax), they are translated, as usual, to OperandValue objects, not ConstantValue objects. The following code will produce criteria with normal query parameters, rather than in-line.