How to create an Entity Framework edmx file for an existing database with .NET Standard and Entity Framework Core?

.net-standard asp.net asp.net-core c# entity-framework-core

Question

In the past, I've been using .NET Framework 4.6 with Entity Framework 6 to generate an edmx file and the associated model files. For one of my projects, I'd like to switch to ASP.NET Core MVC as front end and, therefore, want to change my DAL from .NET Framework 4.6 and EF 6 to .NET Standard 2.

Since the project files were initially created with VS 2012, they still use the old syntax and I somehow can't change the target framework via Visual Studio itself. I've read that is probably easier to just recreate the project with Visual Studio 2017 and target .NET Standard 2 and just step-by-step insert the old code. The first thing that I want to recreate is my Entity Framework mapping with a DBContext. So far, I've added some EF Core dependencies from NuGet, but I fail to create an edmx file that is comparable to what I'm used to from .NET Framework 4.6. Visual Studio does not seem to offer a specific wizard for that in 'add new file'.

What am I missing here? So far, I've checked some previous Stackoverflow posts (such as Trying to set-up Entity Framework core in .Net Standard project) and multiple Udemy courses, but I still don't understand how I can use an equivalent of EF 6 (e.g., an edmx file) in .NET Standard.

1
1
7/23/2018 9:04:52 PM

Accepted Answer

Per Microsoft:

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

https://docs.microsoft.com/en-us/ef/efcore-and-ef6/porting/port-edmx

3
7/23/2018 9:10:41 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow