XPQuery<T> Class
A query that allows the construction of LINQ queries for persistent objects.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.2.dll
NuGet Package: DevExpress.Xpo
#Declaration
public class XPQuery<T> :
XPQueryBase,
IOrderedQueryable<T>,
IEnumerable<T>,
IEnumerable,
IOrderedQueryable,
IQueryable,
IQueryable<T>,
IQueryProvider
#Type Parameters
Name |
---|
T |
#Related API Members
The following members return XPQuery
#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.