XPO - ORM Data Model Designer & LINQ Enhancements, Updates on new Data Sources

XPO Team Blog
26 July 2019

Thought I’d write a quick post to detail a few of the changes we’ve made to our XPO ORM Library in the v19.1 release cycle and a couple of changes we expect to make for our next major release (v19.2). 


  • XPQuery now supports the SelectMany(collectionSelector, resultSelector) overload with two arguments - this simplifies LINQ queries for collections, especially many-to-many associations (v19.2). In certain instance, it helps completely eliminate the need for the Join method. Examples:

    new XPQuery<Test>()
         .Where(c => c.Name == "2")
         .OrderBy(c => c.Oid)
         .SelectMany(c => c.ManyToManyCollection, 
             (t, c) => new { 
                  Test = t, ManyToManyCollectionElement = c 
         .OrderBy(tc => tc.ManyToManyCollectionElement.SubName);
    new XPQuery<Test>()
        .Where(c => c.Name == "2")
        .OrderBy(c => c.Oid)
        .SelectMany(c => new XPQuery<TestRef>()
            .Where(w => w.Owner.Oid == c.Oid && w.Oid >= 0), 
                (r, c) => new { Test = r, TestRef = c })
            .Select(o => new { 
                Name = o.Test.Name, 
                SubName = o.TestRef.SubName 
  • XPQuery supports the new WithDeleted option when it is initialized with a Session-based constructor (v19.2). Examples:

        .Where(e => e.Name == null).ToList();
    new XPQuery<Employee>(unitOfWork)
         .Where(e => e.Name == null).ToList();
  • XPO throws a NotSupportedException when a non-persistent property is used in OrderByXXX or Where expressions (v19.1). You can still set the static DevExpress.Xpo.XPQueryBase.SuppressNonPersistentPropertiesCheck option to False to temporarily disable this behavior (not recommended).

New XPO Data Sources

ORM Data Model Designer

  • The designer can now store connection string in the appsettings.json file of .NET Core projects (v19.2). 
  • You can now control whether to generate JSON serialization and Dependency Injection extensions for XPO in .NET Core apps (v19.2). These extensions are especially helpful for ASP.NET Core and Web API/OData apps.

  • Of course, many other data model generation options are available within the designer: 

  • When a connection to a database fails, the wizard will display detailed error information and links so you can easily troubleshoot connection issues (v19.1).

  • Important Note: Please beware of a Visual Studio issue that causes the ORMDataModel window to render transparently or black. As a workaround, uncheck Environment > General > Optimize rendering for screens in the IDE options and restart (T756731).

Love XPO and want to help us promote it? Add the package through Nuget.org instead of DevExpress Nuget!

Free DevExpress Products – Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We’ll be happy to follow-up.
Wei  Chen
Wei Chen
I'm very glad to see the improvement of xpo.

If XPO can provide more functionality, it will be pleasant.

For example:

1. Support complex interface mapping, including generic support. (Don't tell me DC, DC has handled maintenance mode)

2. Supporting custom SQL crud for persistent objects will help improve performance in large projects.

The developers around us are all concerned with the performance issues of xaf/xpo.

3. Support for default interface implementation in c# 8.0.

I know that each of these features may require a lot of work to complete.

So I didn't give much hope.

Just talk about it.


In the following links, I am trying to implement 1 and 2. There is a lot of code, so I did not change it to English.


26 July 2019
Wei  Chen
Wei Chen
Dennis (DevExpress)
Dennis Garavsky (DevExpress)
@Wei Chen: Thank you for your ticket link and suggestions - our team remembers them, though I cannot promise you any good news regarding persistent interfaces (#3) after our attempt with DC, sorry.

As for #2, your idea with custom SQL CRUD is unclear, especially when it applies to the ORM concept. It is also impossible to comment about performance issues you mentioned without having debuggable samples, profiling results or at least schematical scenario descriptions allowing us to replicate these issues locally.
From my experience in support for XAF and XPO, we sometimes receive user questions about low performance related to ORM. Unfortunately, in more than 95% of cases that we tracked, the root cause is in wrong data model design, inefficient business logic code, not following XAF & XPO best practices and finally database optimization (missing indices or maintenance) on the user side. To help our users to avoid or troubleshoot performance issues, we provide diagnostic tools and promote the following best practices: 

How to measure and improve the application's performance

Debugging, Testing and Error Handling

Of course, we are not perfect and there may be features in our code and we can make more learning materials or features. One example from our 2019 roadmap is XPServerModeView/XPInstandFeedbackView - these components will be integrated in XAF too when they are out of the preview. Finally, you are always welcome to contact our support team with details about your problematic scenarios if your performance analysis confirms problems in our code - we will be more than happy to research your profiling results and scenarios. If possible, please share these links with developers around you. 
As for #1, would you please email us at XpoTeam@devexpress.com or submit a SC ticket using this link and elaborate more on your idea and problematic use-case scenarios, because it is not quite clear what you cannot do with existing inheritance mapping options. We will be happy to consider your requirements if anything is currently missing.
31 July 2019

Please login or register to post comments.