.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

XPQuery<T>.TransformExpression(Session, Expression<Func<T, Boolean>>) Method

Converts a lambda expression into an instance of the CriteriaOperator class descendant.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v21.1.dll


public static CriteriaOperator TransformExpression(
    Session session,
    Expression<Func<T, bool>> expression


Name Type Description
session Session

A Session class instance whose Session.Dictionary and Session.TypesManager are used in the construction of the criteria operator.

expression Expression<Func<T, Boolean>>

A lambda expression.


Type Description

An instance of the CriteriaOperator class descendant that represents the lambda expression.


In the following code snippet the customers collection will contain only the customers named “Bob”:

using DevExpress.Xpo;
using DevExpress.Data.Filtering;


Session MainSession = new Session();
XPQuery<Customer> customersQuery = new XPQuery<Customer>(MainSession);

CriteriaOperator criteria = customersQuery.TransformExpression(c => c.Name == "Bob");

XPCollection<Customer> customers = new XPCollection<Customer>(MainSession);
customers.Criteria = criteria;
See Also