ADO.NET entity data model (.edmx) in ASP.NET MVC core 1.0

半世苍凉 提交于 2019-11-28 13:13:35

ADO.NET entity data model (.edmx) is not supported in Entity Framework Core. Microsoft explained here how to port it.

The closest you can come to porting is to create the model in another project,then copy those files into your .NET core application. This will only work if you have chosen a core application that references the previous Frameworks (4.61, 4.52, etc.) When you copy in the EDMX and associated files, you must make sure that they go into the same project as the .Net core application. (If you reference from another project, you will encounter Visual Studio build errors saying that the EntityFramework.dll can't be accessed. ). After copying in the files, add in EntityFramework from Nuget to fix your dbContext and DbSet references. Here is a good article about how to set up the dependency injection in .Net core for EF6:Tony Sneed Blog

As the other answers have alluded to, there is no support for EDMX. You will need to regenerate your ED models from the data using the new dotnet scaffold command line utility. You can also use that command to scaffold incremental changes to the database.

Check out the documentation for "dotnet" (you might also be interested in migrations` once you move away from EDMX).

Scaffold Command Documentation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!