Skip to main content
All docs
V24.1

Why We Recommend EF Core over XPO for New Development

  • 10 minutes to read

XAF supports two Object-Relational Mapping tools: Entity Framework Core and DevExpress XPO. As you might expect, we often receive comparison requests from XAF UI and Web API Service users: which ORM should I choose? The answer, of course, depends on your tasks, and on how familiar you are with XPO and EF Core. Review the information in this topic to choose the ORM that suits your business needs best in the following scenarios:

  • You are new to our application frameworks, have no knowledge of either ORM, and do not yet know which one to choose.

  • You are starting a new project, have experience with XPO or EF Core, and want to re-evaluate your choice due to ORM issues or new opportunities.

EF Core is the default choice in the Solution Wizard and Getting Started tutorials in v23.1 and later. This change was made because we consider EF Core to be the best choice for new XAF and Web API Service development.

Should Existing XPO Users Migrate to EF Core?

If you have experience with both ORMs and prefer XPO to EF Core, you can continue to use XPO even for new projects - there is no need to switch to EF Core.

Reasons not to switch to EF Core include:

  • We are proud of XPO and all that it offers; it is a mature ORM that we still use in several of our internal projects along with EF Core. New and existing DevExpress customers also continue to use XPO.

  • We continue to develop new XAF and Web API Service features that meet user needs and market demand for XPO and EF Core (there is no “EF Core-First” policy for new XAF development). For instance, XPO supports .NET Core 3, 5, 6, 7, 8, and is expected to support .NET vNext in the future. The new XAF Web API Service and Multi-Tenancy module also support XPO.

  • We will continue to fix security and other XPO bugs (see Version History), enhance XPO code, and update learning materials for XPO users.

When choosing an ORM, we advise that you evaluate the current ORM state as it relates to the issues and requirements of your projects.

Compatibility Considerations on a Potential Migration from XPO to EF Core

To reiterate, DevExpress is not requiring nor asking our customers to migrate from XPO to EF Core. Migration considerations for new projects should be based on your strategic investment in .NET, its potential market changes and the growing popularity of EF Core (see below).

Note that XPO and EF Core are entirely different ORMs. These tools handle many things differently; for instance, inheritance and database schemas for the same logically equal entities will be different for these ORMs with default settings. Business classes for these ORMs cannot be used with the same database tables. We did not plan to make these classes compatible (key type, table names, etc.). Applications cannot easily be moved from XAF to another ORM because of different table structures in their data models. Technically, it is possible to migrate your XAF code from one ORM to another (and we have had a few such customers), but you will also need to manually modify your table structure and migrate data (this requires a deep understanding of ORM internals and we do not consult on such matters).

XPO vs EF Core: Similarities

Aspect

Comparison Result

Tools and Extensions

Both EF Core and XPO support Code-First, Model-First, and Database-First development. Both include logging and profiling tools, a visual designer for the data model, and scaffolding tools that allow you to generate data model classes from existing databases.

EF Core has an advantage when it comes to available tools and extensions implemented by third parties or Microsoft. You can use a large set of paid extensions from DevArt, as well as built-in extensions in Microsoft frameworks and products such as Blazor, OData, Visual Studio, and so on.

Database Schema Migration

Both EF Core and XPO can update database tables after your data model structure changes. EF Core requires that you explicitly execute CLI migrations each time you add new classes or properties at design time (you can automate this behavior). XPO can automatically add tables and columns for new classes and properties. XPO does not modify existing tables, columns, indexes, or foreign keys, nor does it respond to property/column size or type changes, deletions, etc. Handle these changes manually as you would in EF Core.

Performance

EF Core and XPO show comparable performance in popular cases. Advanced scenarios may perform better with either EF Core or XPO. We cannot declare a clear winner in this category.

Benchmarks:

Both EF Core and XPO allow developers to control delayed/lazy, eager, and explicit loading of related data. Both ORMs support XAF’s Data Access Modes, complex LINQ queries, LINQ data projections, and Free Joins.

XAF Module Support

Popular XAF modules support EF Core and XPO. You can use the following modules with any ORM: Security (including Middle Tier Security[1]), Validation, Conditional Appearance, Reports, Audit Trail, File Attachments, Office, Dashboards, and Web API Service. The Clone Object module supports only XPO at the moment. This is not our most popular module and you can implement similar functionality with ease.

Despite the fact that XPO is a DevExpress ORM, XPO has no integration advantages when used with XAF or other DevExpress products.

In 2023, we reached comparable levels of DevExpress Documentation and GitHub Examples that describe XAF integration with XPO or EF Core.

Soft Deletion

Both EF Core and XPO support soft and deferred object deletion. In this case, ORM marks objects as deleted and does not physically remove them from a database right away. This technique helps you avoid database exceptions when deleting objects that are referenced by other entities.

XPO vs EF Core: Differences

Aspect

EF Core

XPO

Product Type

Free and open-source product.

Maintained by Microsoft.

EF Core source code is available on GitHub.

The product is free, but proprietary. For more information, refer to the following page – EULA.

Maintained by DevExpress.

XPO full source code is available to owners of DevExpress Universal and DXperience Subscriptions.

Status

A mature ORM, heavily promoted by Microsoft, with active development on GitHub.

Product releases include annual major feature updates and monthly minor updates with bug fixes.

A mature ORM in maintenance mode.

Annual major updates include support for new versions of .NET, Visual Studio, and the top 5 ADO.NET database drivers. Monthly minor updates contain bug fixes.

Popularity

The Microsoft.EntityFrameworkCore package has 650M total downloads with an average of 250K per day[2].

It is easy to find and hire developers/contractors with EF knowledge.

The DevExpress.Xpo NuGet package has 6.3M total downloads with an average of 3.6K per day[2].

It is difficult to find and hire developers/contractors with XPO knowledge.

Community / Knowledge Base

Entity Framework has over 135K public community-answered questions on Stack Overflow about the different ORM versions. Note that many solutions from older EF versions apply to more recent versions.

Comprehensive online documentation is available at https://learn.microsoft.com/en-us/ef/.

You can find thousands of third party educational resources for EF Core: community videos, tutorials, articles, and consulting/training materials.

Stack Overflow contains less than 100 questions for XPO. The DevExpress Support Center lists about 16K public questions.

Comprehensive online documentation is available on the DevExpress website.

A limited number of third-party educational resources are available.

Database Provider Support

EF Core supports multiple popular relational database providers for both .NET and the .NET Framework.

Free and paid providers exist, both developed by Microsoft or third parties. You can also create custom database providers.

EF Core supports NoSQL databases (not currently used in XAF applications).

Native support for spatial data, DateTimeOffset, DateOnly, TimeOnly, and JSON types.

XPO supports multiple popular relational database providers for .NET and the .NET Framework.

All existing providers are free and developed by DevExpress. You can create custom database providers.

XPO does not support NoSQL databases.

Create a custom solution to support spatial data, DateTimeOffset, DateOnly, TimeOnly, and JSON types.

Data Model Design

EF Core has simple naming conventions to define relationships, keys, and other property and entity types implicitly (without attributes).

EF Core implicitly implements notifications when a property changes. Data model code allows virtual auto properties (get;set;) and does not require you to implement the INotifyPropertyChanged and INotifyPropertyChanging interfaces. For more information, refer to the following topic: Change Tracking in EF Core DbContext and Performance Considerations.

EF Core supports aliased/calculated properties that can be computed using SQL on the database server side. This functionality has limited support for XAF Data Access Modes.

You can also customize the entity type structure or metadata using Fluent API and XAF Types info.

XPO requires you to define relationships and keys explicitly (with attributes).

XPO ships with built-in Base Persistent Classes that save time and lines of code for common scenarios.

XPO requires explicit notification when a property value changes. Data model code requires properties to include SetPropertyValue calls. For more information, refer to the following help section: PropertyChanged Event in XPO.

XPO supports aliased/calculated properties that can be computed using SQL on the database server side. This functionality has full support for XAF Data Access Modes.

You can also customize the entity type structure or metadata using XAF Types info and Model Editor.

Control Concurrency Conflicts

EF Core does not check whether an object has been modified before a commit in XAF applications. If two users change the same object simultaneously, the latest change overrides all other changes. However, you can enable the Optimistic Concurrency control and other strategies manually.

XPO enables the Optimistic Concurrency control in XAF applications by default.

Miscellaneous

XAF does not support a nested IObjectSpace when EF Core is used as ORM. Each view has its independent Object Space. On the one hand, this offers a simpler UI and programming model. On the other, it may lack the flexibility of XPO in certain advanced scenarios. XAF does not currently have an asynchronous version of IObjectSpace for EF Core.

EF Core does not allow you to add new properties to an existing data model dynamically (at runtime).

Web API Service powered by EF Core does not currently support creation and modification of nested collections and reference properties.

XPO allows you to create a nested IObjectSpace. When you commit changes made in a nested Object Space, changes are merged back into the parent Object Space. This technique allows you to treat multiple related operations as a single unified operation. XAF also has an asynchronous version of IObjectSpace for XPO.

XPO allows you to add new properties to an existing data model dynamically through XPDictionary or XAF Types info (for advanced scenarios).

Web API Service powered by XPO ships with better support for creation and modification of nested collections and reference properties.

Footnotes
  1. EF Core supports Middle Tier Security in v23.1 and later.

  2. All statistics are as of March 2023.

See Also