无法将ADO.NET实体数据模型添加到.NET Core 2.1项目 [英] Can't Add ADO.NET Entity Data Model to .NET Core 2.1 Project
问题描述
如标题所示,我已经安装了 .NET Core 2.1 SDK 和创建了一个新的.NET Core 2.1项目.当我进入项目>添加项目...>数据时,我没有 ADO.NET实体数据模型选项.
As the title states, I've installed the .NET Core 2.1 SDK and created a new .NET Core 2.1 project. When I go to Project > Add Item... > Data, I do not have the ADO.NET Entity Data Model option.
我使用的是 Visual Studio 2017 15.7.3 ,它是在几小时前安装的.
I am using Visual Studio 2017 15.7.3, which I've installed only hours ago.
错误和警告日志是干净的.
The Error and Warning logs are clean.
我们将为您提供任何帮助.
Any assistance is appreciated.
- 已研究.您会注意到,我主要从以下三个资源中撤出了大部分解决此问题的尝试:
- StackOverflow:找不到ADO.netVS 2017中的实体数据模型模板 (此问题是2.1之前的版本,尚无公认的答案,因此我认为值得进行更新的讨论)
- 微软:宣布实体框架核心2.0版
- Microsoft文档:EF Core入门在具有现有数据库的ASP.NET Core上
- NuGet
- Microsoft.EntityFrameworkCore(2.1.0)
- Microsoft.EntityFrameWorkCore.Relational(2.1.0)
- Microsoft.EntityFrameworkCore.SqlServer(2.1.0)
- Microsoft.EntityFrameworkCore.Tools(2.1.0)
- Microsoft.VisualStudio.Web.CodeGeneration.Design(2.1.0)
- Microsoft.NETCore.App(2.1.0)
- NETStandard.Library(2.0.3)
推荐答案
EntityFramework Core不使用"EDMX"数据模型设计器,它纯粹是代码优先的.
EntityFramework Core doesn't use the "EDMX" data model designers, it is purely code-first.
请参见 EF Core入门具有现有数据库的ASP.NET Core ,可以从现有数据库中构建数据库上下文,或者创建新模型,并使用迁移来创建和更新数据库.
See the Getting Started with EF Core on ASP.NET Core with an Existing Database to scaffold a database context from an existing database or create a new model and use migrations to create and update databases.
更新:在.NET Core 3.0中,您将能够将Entity Framework 6与.edmx模型一起使用(可能需要VS 2019)
Update: In .NET Core 3.0, you will be able to use Entity Framework 6 along with .edmx models (which may require VS 2019)
这篇关于无法将ADO.NET实体数据模型添加到.NET Core 2.1项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!