问题
The Issue...
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.
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.
What I've done so far...
- Researched. You'll notice I've pulled most of my attempts to solve this issue from primarily these three resources:
- StackOverflow: Can't find ADO.net Entity Data Model template in VS 2017 (This question is pre-2.1 and has no accepted answer, so I feel this deserves an updated discussion)
- Microsoft: Announcing Entity Framework Core 2.0
- Microsoft Docs: Getting Started with EF Core on ASP.NET Core with an Existing Database
- Ensured that Entity Framework 6 Tools is included in my VS installation
- Added the following dependencies...
- 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)
- SDK
- Microsoft.NETCore.App (2.1.0)
- NETStandard.Library (2.0.3)
- NuGet
- Build / Rebuild / Clean / Restart Visual Studio / Restart PC
回答1:
EntityFramework Core doesn't use the "EDMX" data model designers, it is purely code-first.
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.
Update: In .NET Core 3.0, you will be able to use Entity Framework 6 along with .edmx models (which may require VS 2019)
来源:https://stackoverflow.com/questions/50790071/cant-add-ado-net-entity-data-model-to-net-core-2-1-project