Skip to main content
A newer version of this page is available. .
All docs
V22.2

Why We Recommend EF Core over XPO for New Development

  • 8 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 and have no knowledge of either ORM and do not yet know what to choose.

  • You are starting a new project, have earlier 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 since v23.1. We made that change because we consider EF Core the best choice for new XAF and Web API Service development.

However, if you have experience with both ORMs and prefer XPO to EF Core, you can continue to use XPO as long as it meets your business needs.

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 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 3rd 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, and 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 with 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 both 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 support XPO only at the moment. This is by far not our most popular module and you can implement similar funtionality with ease.

Despite being 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 or 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 yearly major feature updates and monthly minor updates with bug fixes.

A mature ORM in maintenance mode.

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

Popularity

The Microsoft.EntityFrameworkCore package has 650M total downloads and 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 and 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 questions answered by the community on Stack Overflow for different versions (many solutions from older EF versions apply to the latest versions).

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

You can find thousands of 3rd 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 of public questions.

Comprehensive online documentation is available on the DevExpress website.

A limited number of 3rd 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 3rd 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 both .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.

Support for spatial data, DateTimeOffset, DateOnly, TimeOnly, JSON types is available via custom solutions.

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 hand it may lack the flexibility of XPO in certain advanced scenarios. XAF also 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).

The Security System requires Multiple Active Result Sets (MARS) in EF Core-based XAF applications connected to the Microsoft SQL Server and other databases. For example, the ADO.NET provider supports MARS itself, but PostreSQL does not support it and requires workarounds.

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).

XPO does not require ADO.NET providers to support Multiple Active Result Sets (MARS) for the correct XAF operation.

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 from v23.1.

  2. All statistics are as of March 2023.

See Also