XPQuery<T> Class
A query that allows the construction of LINQ queries for persistent objects.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.1.dll
NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap, DevExpress.Xpo
NuGet Package: DevExpress.Xpo
Declaration
Type Parameters
Name |
---|
T |
Remarks
To execute LINQ queries for persistent objects, perform the following steps:
- Create the XPQuery<T> instance of the required type.
- 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.