Back to Devexpress

Limitations of CriteriaOperator.Parse

corelibraries-5411-devexpress-data-library-limitations-of-criteriaoperatorparse.md

latest1.5 KB
Original Source

Limitations of CriteriaOperator.Parse

  • Aug 05, 2022
  • 2 minutes to read

The common way to query objects is to use the static CriteriaOperator.Parse method. However, there are two limitations you must know when using this method:

  • The Parse method does not accept arrays as arguments. Instead, you should use InOperator.

  • The Parse method does not work with a string returned by the CriteriaOperator.ToString method, if criteria contain object references.

To avoid the problems mentioned above, we suggest that you use Simplified Criteria Syntax:

csharp
XPCollection<Order> col3 = new XPCollection<Order>(session1, Order.Fields.Customer == o.Customer);
vb
Dim col3 As New XPCollection(Of Order)(session1, Order.Fields.Customer = o.Customer)

Note

You can register custom enumerations using static methods of the EnumProcessingHelper class and then refer to enumeration values as follows:

Status = ##Enum#MyNamespace.Status,InProgress#

See Also

Build Criteria - Cheat Sheet