29

I am starting a new ASP.NET 5 Preview template to play with client side development.

I have a database ( MS SQL ) that I want to access using the Web API and Entity Framework.

In my Models folder I do like I am used to do, add a new item and I want to add the ADO.NET Entity Data Model but it isn't there.

What am I missing here?

UPDATE

This is the only thing I see when I try to add a new item to the project. Client side and server side.

enter image description here

Renan Araújo
  • 3,533
  • 11
  • 39
  • 49
Mivaweb
  • 5,580
  • 3
  • 27
  • 53
  • Did you install the Entity Framework package? – CodeCaster Sep 07 '15 at 11:13
  • Yes using the package.json. I see Entity Framework installed under my `Dependencies` – Mivaweb Sep 07 '15 at 11:17
  • What version of EF? EF 7 is [code first only](http://blogs.msdn.com/b/adonet/archive/2014/10/21/ef7-what-does-code-first-only-really-mean.aspx) so no .edmx file – SimonGates Sep 07 '15 at 11:24
  • same here, http://stackoverflow.com/questions/31553674/ado-net-model-for-db-is-gone-visual-studio-2015 suggests it is enough to install SQL Server Data Tools. but apparently didn't change anything for me. – mikus Sep 21 '15 at 21:38
  • 1
    As you said you are using *Professional Edition*, You should *remove Community word from question title* to avoid ambiguity! They're different versions. – Amirhossein Mehrvarzi Sep 22 '15 at 08:58
  • I am using `VS 2015 Community edition` and not getting `Entity Data Model` in my `Web API` project. I installed `EF 6.1.3` using `NuGet Package Manager` but getting an error which says: `The dependency EntityFramework 6.1.3 in project does not support framework DNXCore, Version=v5.0`. I have posted my issue here in detail: http://stackoverflow.com/questions/34745822/how-can-i-call-a-sql-stored-procedure-using-entityframework-7-and-asp-net-5?noredirect=1#comment57238614_34745822 – Subrata Sarkar Jan 13 '16 at 10:42
  • I found that when using EFCore you need to install `EntityFrameworkCore` (EF7) to your project. I notice that they have changed the way you map to the database compared with EF6, there is no EDMX file. https://learn.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db – Danny Cullen Nov 23 '16 at 12:22

7 Answers7

11

After a lot of research, I found out that there are some compatibility issues where come from the recent Microsoft migration to open source world (since Asp.net5) that I obtained from Data Points - The EF6, EF7 and ASP.NET 5 Soup MSDN Article. Read the full article please.

So if you wanna have both EF6 and Asp.net5, consider the article tips. And if you don't persist in using Asp.net5, simply use Asp.net4.5 (following image) which have Ado.net Data Model in Add New Item dialog (I tested its availability with my Visual Studio Enterprise).

enter image description here

Amirhossein Mehrvarzi
  • 18,024
  • 7
  • 45
  • 70
  • Thanks a lot for the headsup! It also works here when I select the ASP.NET 4.5, then I can select the ADO.NET Data Model. – Mivaweb Sep 23 '15 at 07:17
  • Create a new class library and in there you can create items from the "Data" category – krilovich Nov 11 '15 at 18:29
7

May sound stupid, but since I got caught with this, it might be someone else's issue too...

In VS 2015, there are 2 project templates called Class Library... one being in Windows and one in the Web and having (package) suffix. Apparently, besides misleading name they have nothing to do with each other and the second one clearly is not made to support EF models... Make sure you have created a proper project type or open a working solution made with different VS version.

__

Also this might help. I have it already installed, so not sure if it affects my configuration or not (shouldnt as EF tools are supposed to be shipped already with VS 2015):

http://thedatafarm.com/data-access/installing-ef-power-tools-into-vs2015/

mikus
  • 3,042
  • 1
  • 30
  • 40
  • 2
    This was my issue as well .. Make sure to do add project- > new project -> Visual C# -> Class Library .. only then you will have the option to add items under the "Data" category – krilovich Nov 11 '15 at 18:28
  • My issue too. Thanks! – mga911 Nov 18 '15 at 21:21
6
  1. Right click on project
  2. Choose Add and then New Item (or Simply press Ctrl+Shift+A)
  3. You will see a Data section which you can find what you are looking for

Or You can find another solution Here: Missing ADO.NET entity data model template from visual studio 2012 professional

Community
  • 1
  • 1
Inside Man
  • 4,194
  • 12
  • 59
  • 119
  • Just Updated, hope it helps. – Inside Man Sep 10 '15 at 14:35
  • The "Missing ADO.NET entity data model ..." worked for me for VS 2015. I'd suggest rephrasing your answer (if you find no relevant templates in the Data section ...) and inlining the most important details from linked answer (search for eftools.msi in c:\programdata\package cache, then run it and choose install/repair; don't know whether it'll be better to close VS, mine was not running). Not mentioning the 2012 version, or confirming it worked even for 2015 might be useful. Anyway, thank you very much for the pointer, if I haven't found this in post mentioning 2015, i might have ignored it ! – Miloslav Raus Sep 23 '15 at 11:01
2

Create New MVC Project using VS2015

  1. Right-Click on Model folder.
  2. Choose Add and then Select Class from the list.
  3. Now select ADO.Net Entity Data Model... and go for your selection.
lxg
  • 12,375
  • 12
  • 51
  • 73
1

ADO.NET Entity Data Model missing Visual Studio 2017 Community

How to enable:

Open Visual Studio Installer -> Individual Components -> SDK's, libraries, and frameworks -> Enable EntityFramework 6 tools-> Modify

Now, Add item in your project -> Data -> ADO.NET Entity Data Model.

Visual Studio Installer

Mark G
  • 2,848
  • 1
  • 24
  • 32
Abhi
  • 126
  • 1
  • 9
0

Note: While Creating project don't select class Library(.NET Standard) Choose Class Library (.NET Framework)

enter image description here

mabdullahse
  • 3,474
  • 25
  • 23
0

I solved the same problem by following these:

  1. While Creating project don't select class Library(.NET Standard) Choose Class Library (.NET Framework)

  2. Choose ASP.NET Web Application (.NET Framework)

  3. Go to Tools -> Get Tools and features. Select Individual components tab and check Entity Framework 6 tools under SDK's, libraries, and framework section

  4. Remember you can't make an ADO.net Entity Data Model with an interface with .NET Core, its only possible with .NET Framework.

sanastasiadis
  • 1,182
  • 1
  • 15
  • 23
Temish
  • 1
  • 1