Today we are making Entity Framework 7 RC1 available. EF7 will be the next major release of Entity Framework and is currently in pre-release.
When to use EF7
As discussed in our EF7 – v1 or v7 post, EF7 introduces some significant changes and improvements over EF6.x. Because EF7 is based on a new core, the features from EF6.x do not automatically carry over into EF7. For this reason, EF6.x may still be the most suitable release for many applications – at least for the time being.
The situations where we would recommend using EF7 are:
- New applications that do not need the features that are not yet implemented in EF7.
- Applications that target .NET Core, such as Universal Windows Platform (UWP) and ASP.NET 5 applications.
For all other applications, you should consider using EF6.x. EF6.x will continue to be a supported release for some time – see the end of this post for more details on upcoming releases.
Because of the fundamental changes in EF7 we do not recommend attempting to move an EF6.x application to EF7 at this stage. If you want to move to EF7 to make use of new features, then make sure you are aware of the limitations of EF7 before you start. You should view the move from EF6.x to EF7 as a “port” rather than an “upgrade”.
Getting started with EF7
You can find the documentation for EF7 at docs.efproject.net. In particular, you probably want to start with a tutorial for the type of application you want to build.
- Full .NET (Console, WPF, WinForms, and ASP.NET 4)
- Universal Windows Platform (UWP)
- ASP.NET 5
The following database providers are available on NuGet.org and support RC1. See our providers page for more information and links to getting started.
Glimpse also announced Glimpse 2 Beta 1 today, which supports EF7 and ASP.NET 5 RC1.
What’s implemented in RC1
The following features have been added since our last release (Beta 8).
- Cascade delete support
- Table-Per-Hierarchy inheritance pattern
- .NET Native support (allows deployment of UWP applications that use EF7)
- Improved documentation
The following features were implemented in previous releases and continue to be available (most of them with improvements).
- Basic modeling including built-in conventions, table/column mapping, and relationships
- Fluent API (a.k.a ModelBuilder/OnConfiguring API) for configuring your model
- Data Annotations for configuring your model
- Change tracking
- LINQ queries
- Table based Insert/Update/Delete (including batching)
- Migrations and database creation/deletion
- Transactions (including automatic transactions during SaveChanges and explicit transaction APIs)
- Identity and Sequence patterns for database generated key values
- Raw SQL queries (via DbSet.FromSql)
- Alternate keys including the ability to use them as keys in a relationship
- Reverse engineering a model from an existing database
What’s coming in RTM
As we head towards our initial RTM of EF7 we will be focusing on cross-cutting quality concerns. There are no additional features planned for the RTM release.
- Bug fixing
- Performance tuning
As you can see from our issue tracker there are still a number of issues we are working to resolve prior to the RTM release. Please continue to report any new issues that you hit so that we can address them.
One area of RC1 that has a number of outstanding issues is our query pipeline. The majority of issues result in an exception when you attempt to execute a LINQ query that contains a particular pattern. There are often ways to workaround these issues by expressing the same query using different patterns, or evaluating parts of the query client-side. We try to include these workarounds in the issue, when they are available.
We have a set of benchmarks that we are using to measure and tune the performance of EF7. In RC1, there are a number of scenarios where EF7 performs slower than EF6. We’ve already addressed a lot of these in our working code base and are working to address the remaining ones.
As an example, here are the results from our SimpleQueryTests.Include test that queries for 1000 Customers, including their related orders (2000 total orders, 2 for each customer). This variation has change tracking enabled*. The red line represents the code base used for RC1. The vertical axis is time taken for the query to execute and results to be fully materialized. As you can see our EF7 results are slower than EF6 in RC1 but significantly faster in our current code base.
*Note we are showing the “change tracking on” variation in this example because the “change tracking off” variation was already faster than EF6 in RC1.
An update on EF6.x
Given that we have said EF6.x will continue to be a supported release, and that we will continue with bug fixes and small improvements to the code base, you may be asking why there hasn’t been much activity on the EF6.x CodePlex project for the last 6 months.
For the lead up to initial release of EF7 we are having our team focus almost solely on the EF7 project, but once we get EF7 stabilized and ready for release we will be transitioning back to dedicating some time to work on EF6.x. Our initial focus will be to get a pre-release of EF6.2 available. This will start with processing the outstanding pull requests and fixing the bugs we have already allocated to the EF6.2 release. We anticipate having the first preview of EF6.2 available shortly after EF7 reaches RTM.