What is the replacement in Visual Studio 2017 for Entity Framework 'database first'

为君一笑 提交于 2019-12-13 13:27:12

问题


Simple question - I'm working in Visual Studio 2017 and while I know that the 'database first' approach in EF is gone, I'm wondering what the replacement is. What I specifically would like to do is generate classes from an existing database. I see this: EntityFramework Reverse POCO Generator - is this the right option, or is there something in VS2017 I should be using? I would think that this would be obvious information, maybe I'm looking in the wrong place...

Note: I have an ASP.NET Core project, but am not using EF Core. I am using ASP.NET Core against the full .NET framework and EF6.


回答1:


You need to create a .NET Class Library for your EF6 code, and you can add Entity Data Model (with Database First) to this, or use EF Reverse POCO in this as well, but it must be a standard old-school csproj based project.




回答2:


Add a class library to your solution. Add new item to the class library and you will find the data template which holds the Entity Model. Choose and Configure (here you will find the 'database first' option) the entity model in the same old way. That's it. :)



来源:https://stackoverflow.com/questions/44297967/what-is-the-replacement-in-visual-studio-2017-for-entity-framework-database-fir

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