实体框架未出现在Visual Studio 2017中的添加新项目列表中 [英] Entity Framework not appearing in Add New Item list in Visual Studio 2017

查看:625
本文介绍了实体框架未出现在Visual Studio 2017中的添加新项目列表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2017中创建了一个新的MVC项目。我想添加一个EDMX文件(我将首先做数据库),所以右击项目并选择Add | New Item。



但是,我找不到以前版本的Visual Studio中可用的Entity Framework组件。有谁知道他们去哪里了?



解决方案

在基于.NET Framework的项目中,Entity Framework 6模板仍然存在。但是,对于基于.NET Core的项目,我相信您应该使用 dotnet ef 命令。这包括从现有数据库中构建代码优先的 DbContext 的方法。请参阅 ASP.NET核心 - 现有数据库



为了验证这一点,我设置了一个具有以下结构的演示项目:





新项/数据对话框 .NET Framework 项目:





请注意,还有一个 EF POCO Generator 您可能会感兴趣的在线模板部分:




I created a new MVC project in Visual Studio 2017. I wanted to add an EDMX file (I will be doing database-first) so right clicked on the project and selected Add|New Item.

However, I cannot find the Entity Framework components that were available in the previous versions of Visual Studio. Does anyone know where they went?

解决方案

In .NET Framework-based projects, the Entity Framework 6 templates are still there. However, for .NET Core-based projects, I believe you're expected to use the dotnet ef commands. This includes a means of scaffolding a code-first DbContext from an existing database. See ASP.NET Core - Existing Database.

To verify this, I setup a demo project with the following structure:

The New Item/Data dialog for the .NET Framework project:

Note that there is also an EF POCO Generator template available in the Online templates section that may be of interest to you:

这篇关于实体框架未出现在Visual Studio 2017中的添加新项目列表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆