Skip to main content

ConstantValue Class

A constant value operand in criteria expressions.

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v24.1.dll

NuGet Package: DevExpress.Data

Declaration

public class ConstantValue :
    OperandValue

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.

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