ConstantValue Class

A constant value operand in criteria expressions.

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v19.2.dll

Declaration

public class ConstantValue :
    OperandValue
Public Class ConstantValue
    Inherits OperandValue

Remarks

Normally, 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 a number of 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.


CriteriaOperator filter = CriteriaOperator.Parse("LastName = 'Smith'");

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.


CriteriaOperator filter = CriteriaOperator.Parse("LastName = ?", "Smith");

 

NOTE

In-line parameters are supported for Int32, Boolean, String, and Enum operand values.

Inheritance

See Also