[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Collapse]eXpress Persistent Objects
 [Expand]Product Information
 [Expand]Getting Started
 [Collapse]Feature Center
  [Expand]Data Representation
  [Expand]Object Relational Mapping
  [Expand]Connecting to a Data Store
  [Expand]Data Exchange and Manipulation
  [Collapse]Querying a Data Store
    Creating Criteria
    Direct SQL Queries
    Free Joins
    Limitations of CriteriaOperator.Parse
    LINQ to XPO
    LINQPad Context Driver
    Stored Procedures
  [Expand]Using XPO in Web Applications
 [Expand]Design-Time Features
 [Expand]Member Tables
 [Expand]API Reference
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)


XPO includes the XPQuery<T> class tailored for constructing LINQ expressions against persistent objects.

You have the following options to create XPQuery<T> instances.

  • Create an instance from a session's scope, via the session's DevExpress.Xpo.XPQueryExtensions.Query extension method.
  • Pass a Session to an XPQuery<T> constructor.

In addition to calling the DevExpress.Xpo.XPQueryExtensions.Query extension method, you can call the DevExpress.Xpo.XPQueryExtensions.QueryInTransaction``1 method to include all in-memory object changes to query results (as if Session.InTransactionMode is enabled). To create an InTransaction XPQuery<T> instance based on an existing XPQuery<T> instance, call its XPQuery<T>.InTransaction method.

Expanded Sample Expressions


You can find a sample project in the LINQ to XPO Knowledge Base article. You should have Visual Studio 2008 and SQL Server 2005 or 2000 with the Northwind demo database.

To learn how to implement custom functions and criteria, and use them in LINQ to XPO expressions, see How to: Implement Custom Functions and Criteria in LINQ to XPO.

Expanded LINQ to XPO Limitations

  • The maximum number of total or group summaries allowed is 14.
  • The FirstOrDefault method is not supported for property initialization in the Select statement.
  • Cross Join queries are not supported.

Expanded See Also

Is this topic helpful?​​​​​​​