This documentation is for EF Core. For EF6.x and earlier release see http://msdn.com/data/ef.
Porting an EDMX-Based Model (Model First & Database First)¶
EF Core does not support the EDMX file format for models. The best option to port these models, is to generate a new code-based model from the database for your application.
In this article:
Microsoft.EntityFrameworkCore.Tools NuGet package.
You also need to install the design time NuGet package for the database provider you want to use. This is typically the runtime database provider package name with
.Design post-fixed. For example, when targeting SQL Server, you would install
Microsoft.EntityFrameworkCore.SqlServer.Design. See Database Providers for details.
You can now use the reverse engineer functionality to create a model based on your existing database.
Run the following command in Package Manager Console (Package Manager Console (Visual Studio) for command options to scaffold a subset of tables etc.). See
Scaffold-DbContext "<connection string>" <database provider name>
For example, here is the command to scaffold a model from the Blogging database on your SQL Server LocalDB instance.
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer
You would now remove the EF6.x model from your application.
It is fine to leave the EF6.x NuGet package (EntityFramework) installed, as EF Core and EF6.x can be used side-by-side in the same application. However, if you aren’t intending to use EF6.x in any areas of your application, then uninstalling the package will help give compile errors on pieces of code that need attention.
At this point, it’s a matter of addressing compilation errors and reviewing code to see if the behavior changes between EF6.x and EF Core will impact you.