Skip to main content
.NET Framework 4.6.2+

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.v24.2.dll

Declaration

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

Parameters

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.

Returns

Type Description
CriteriaOperator

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

Example

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