Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

XPQuery<T> Class

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

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v19.1.dll

Declaration

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

Type Parameters

Name
T

Remarks

To execute LINQ queries for persistent objects, perform the following steps:

  1. Create the XPQuery<T> instance of the required type.
  2. Write the required LINQ queries for the created XPQuery<T> instance.

The following code snippet illustrates this. It prints the last names of all the customers named “John”:


using DevExpress.Xpo;

//...

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

var customers = from c in customersQuery
                where c.Name == "John"
                select c;

foreach (Customer customer in customers)
    Console.WriteLine(customer.LastName); 

For more examples on using the XPQuery<T> class, refer to the LINQ to XPO knowledge base article.

XPO LINQ expressions are processed on the database server side and only the requested objects are loaded into the application.

Inheritance

Extension Methods

Show 60 items
See Also