.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
A newer version of this page is available. Switch to the current version.

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

Declaration

public static CriteriaOperator TransformExpression(
    Session session,
    Expression<Func<T, bool>> expression
)
Public Shared Function TransformExpression(
    session As Session,
    expression As Expression(Of Func(Of T, Boolean))
) As CriteriaOperator

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.

Examples

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