Skip to main content
.NET 8.0+

XPQuery<T> Class

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

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.2.dll

Declaration

public class XPQuery<T> :
    XPQueryBase,
    IOrderedQueryable<T>,
    IEnumerable<T>,
    IEnumerable,
    IOrderedQueryable,
    IQueryable,
    IQueryable<T>,
    IQueryProvider
public class XPQuery<T> :
    XPQueryBase,
    IOrderedQueryable<T>,
    IQueryable<T>,
    IEnumerable<T>,
    IEnumerable,
    IQueryable,
    IOrderedQueryable,
    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 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 64 items
See Also