Scenario
XPO includes the XPQuery<T> class tailored for constructing LINQ expressions against persistent objects. XPO to LINQ expressions are turned into pure database queries. That is, an expression is processed on the database server side, and only the requested objects or a scalar value are loaded onto the client
This example illustrates several sample queries such as:
- Group Join
- Select with Where and OrderBy clauses
- Select Top 5 objects
- Aggregated Functions
For implementation details, see the Form1.xx file.
Important notes:
1. To evaluate expression on the server, use Expression<Func<T>> instead of Func<T> .
2. The maximum allowed number of total or group summaries is 14.
3. The FirstOrDefault method does not support the property initialization in the Select statement.
4. Cross Join queries are not supported.
See Also:
.NET Language-Integrated Query
eXpress Persistent Objects > Feature Center > Querying a Data Store > LINQ to XPO
How to: Implement Custom Functions and Criteria in LINQ to XPO
XPQueryExtensions.Query<T>
XPQueryExtensions.QueryInTransaction<T>
How to populate a List View with data from a LINQ query