Table of Contents

Class XPQuery<T>

Namespace
DevExpress.Xpo
Assembly
DevExpress.Xpo.v24.1.dll

A query that allows the construction of LINQ queries for persistent objects.

public class XPQuery<T> : XPQueryBase, IPersistentValueExtractor, IOrderedQueryable<T>, IOrderedQueryable, IQueryable<T>, IEnumerable<T>, IQueryable, IEnumerable, IQueryProvider

Type Parameters

T
Inheritance
XPQuery<T>
Implements
Inherited Members
Extension Methods

Constructors

XPQuery(IDataLayer)

Initializes a new instance of the XPQuery<T> class with specified settings.

public XPQuery(IDataLayer dataLayer)

Parameters

dataLayer IDataLayer

XPQuery(XPDictionary)

Creates an instance of the XPQuery<T> class with the specified settings.

public XPQuery(XPDictionary dictionary)

Parameters

dictionary XPDictionary

The XPDictionary class descendant’s instance which provides metadata on persistent objects in a data store.

XPQuery(XPDictionary, bool)

Creates an instance of the XPQuery<T> class with specified settings.

public XPQuery(XPDictionary dictionary, bool inTransaction)

Parameters

dictionary XPDictionary

The XPDictionary class descendant’s instance, which provides metadata on persistent objects in a data store.

inTransaction bool

true to enable the InTransaction mode; otherwise, false.

XPQuery(Session)

Creates an instance of the XPQuery<T> class with the specified settings.

public XPQuery(Session session)

Parameters

session Session

The Session class instance which is used to retrieve persistent objects in LINQ queries.

XPQuery(Session, bool)

Creates an instance of the XPQuery<T> class with specified settings.

public XPQuery(Session session, bool inTransaction)

Parameters

session Session

A Session class instance which is used to retrieve persistent objects in LINQ queries.

inTransaction bool

true to enable the InTransaction mode; otherwise, false.

Methods

Clone()

Clones the current query.

public XPQuery<T> Clone()

Returns

XPQuery<T>

An XPQuery<T> object which represents a clone of the current query.

CloneCore()

protected override object CloneCore()

Returns

object

Deserialize(IDataLayer, string)

public static XPQuery<T> Deserialize(IDataLayer dataLayer, string data)

Parameters

dataLayer IDataLayer
data string

Returns

XPQuery<T>

Deserialize(XPDictionary, string)

Creates an instance of the XPQuery<T> class from its string representation.

public static XPQuery<T> Deserialize(XPDictionary dictionary, string data)

Parameters

dictionary XPDictionary

The XPDictionary class descendant’s instance which provides metadata on persistent objects in a data store.

data string

The string representation of the query, obtained via the XPQueryBase.Serialize method.

Returns

XPQuery<T>

An instance of the XPQuery<T> class.

Deserialize(Session, string)

Creates an instance of the XPQuery<T> class from its string representation.

public static XPQuery<T> Deserialize(Session session, string data)

Parameters

session Session

The Session class instance which is used to retrieve persistent objects in LINQ queries.

data string

The string representation of the query, obtained via the XPQueryBase.Serialize method.

Returns

XPQuery<T>

An instance of the XPQuery<T> class.

ExecuteAsync<S>(Expression, CancellationToken)

public Task<S> ExecuteAsync<S>(Expression expression, CancellationToken cancellationToken = default)

Parameters

expression Expression
cancellationToken CancellationToken

Returns

Task<S>

Type Parameters

S

InTransaction()

Creates an InTransaction instance of an XPQuery<T> based on the current XPQuery<T> instance.

public XPQuery<T> InTransaction()

Returns

XPQuery<T>

An InTransaction XPQuery<T> instance created from the current XPQuery<T>, using the corresponding constructor with true passed to the inTransaction parameter.

TransformExpression(XPDictionary, Expression<Func<T, bool>>, CustomCriteriaCollection)

public static CriteriaOperator TransformExpression(XPDictionary dictionary, Expression<Func<T, bool>> expression, CustomCriteriaCollection customCriteriaCollection)

Parameters

dictionary XPDictionary
expression Expression<Func<T, bool>>
customCriteriaCollection CustomCriteriaCollection

Returns

CriteriaOperator

TransformExpression(Session, Expression<Func<T, bool>>)

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

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

Parameters

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, bool>>

A lambda expression.

Returns

CriteriaOperator

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

TransformExpression(Session, Expression<Func<T, bool>>, CustomCriteriaCollection)

Intended for internal use.

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

Parameters

session Session
expression Expression<Func<T, bool>>
customCriteriaCollection CustomCriteriaCollection

Returns

CriteriaOperator

TransformExpression(Expression<Func<T, bool>>)

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

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

Parameters

expression Expression<Func<T, bool>>

A lambda expression.

Returns

CriteriaOperator

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

TransformExpression(Expression<Func<T, bool>>, CustomCriteriaCollection)

Intended for internal use.

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

Parameters

expression Expression<Func<T, bool>>
customCriteriaCollection CustomCriteriaCollection

Returns

CriteriaOperator

WithCustomCriteria(CustomCriteriaCollection)

Intended for internal use.

public XPQuery<T> WithCustomCriteria(CustomCriteriaCollection customCriteriaCollection)

Parameters

customCriteriaCollection CustomCriteriaCollection

Returns

XPQuery<T>

WithCustomCriteria(ICustomCriteriaOperatorQueryable)

Intended for internal use.

public XPQuery<T> WithCustomCriteria(ICustomCriteriaOperatorQueryable customCriteria)

Parameters

customCriteria ICustomCriteriaOperatorQueryable

Returns

XPQuery<T>

WithDeleted()

Creates an XPQuery<T> based on the current XPQuery<T> instance. The new query retrieves objects specified by the original query and also selects objects marked as deleted that match that query.

public XPQuery<T> WithDeleted()

Returns

XPQuery<T>

An XPQuery<T> instance.