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

XPQuery<T>.TransformExpression(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

Declaration

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

Parameters

Name Type Description
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