General Information
.NET Subscription
Desktop
Web
Controls and Extensions
Mainteinance Mode
Enterprise and Analytic Tools
Quality Assurance and Productivity
Frameworks and Libraries
All docs
V19.2
General Information
.NET Subscription
Desktop
Web
Controls and Extensions
Mainteinance Mode
Enterprise and Analytic Tools
Quality Assurance and Productivity
Frameworks and Libraries
19.2
19.1
18.2
18.1
17.2
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
XPQuery<T> Class
A query that allows the construction of LINQ queries for persistent objects.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v19.2.dll
Declaration
public class XPQuery<T> :
XPQueryBase,
IOrderedQueryable<T>,
IQueryable<T>,
IEnumerable<T>,
IEnumerable,
IQueryable,
IOrderedQueryable,
IQueryProvider
Public Class XPQuery(Of T)
Inherits XPQueryBase
Implements IOrderedQueryable(Of T),
IQueryable(Of T),
IEnumerable(Of T),
IEnumerable,
IQueryable,
IOrderedQueryable,
IQueryProvider
public class XPQuery<T> :
XPQueryBase,
IOrderedQueryable<T>,
IEnumerable<T>,
IEnumerable,
IOrderedQueryable,
IQueryable,
IQueryable<T>,
IQueryProvider
Public Class XPQuery(Of T)
Inherits XPQueryBase
Implements IOrderedQueryable(Of T),
IEnumerable(Of T),
IEnumerable,
IOrderedQueryable,
IQueryable,
IQueryable(Of T),
IQueryProvider
Type Parameters
Name | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
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);
Imports DevExpress.Xpo
'...
Dim MainSession As New Session()
Dim customersQuery As XPQuery(Of Customer) = New XPQuery(Of Customer)(MainSession)
Dim customers = from c in customersQuery where c.Name = "John" select c
For Each customer As Customer In customers
Console.WriteLine(customer.LastName)
Next customer
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
Object
XPQueryBase
XPQuery<T>
Extension Methods
See Also
Feedback