Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't Add ADO.NET Entity Data Model to .NET Core 2.1 Project

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)
  • Build / Rebuild / Clean / Restart Visual Studio / Restart PC
like image 253
Tyler Roper Avatar asked Jun 11 '18 03:06

Tyler Roper


People also ask

How do I add ado net entity data model?

Create the ADO.NET Entity Data ModelRight-click on your project in the Solution Explorer window and select the menu option Add -> New Item. In the Add New Item dialog, select the Data category. Select the ADO.NET Entity Data Model template, give the Entity Data Model the name Northwind. edmx, and click the Add button.

Is ADO.NET supported in .NET Core?

NET Core. So as long as you have a valid connection string to connect to your existing legacy database, you should be just fine.

Is Entity Framework compatible with .NET Core?

You can use EF Core for all your entities and migrations as well as any ASP.NET Core apps, and use EF6 as "code first with an existing database" for compatibility in legacy apps.

Can we use Entity Framework and ADO.NET together?

EF is built on top of ADO.Net, meaning that you can use both at the same time.


1 Answers

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)

like image 193
Martin Ullrich Avatar answered Oct 19 '22 01:10

Martin Ullrich