Entity Framework Not Generating Classes for Tables or Procedures

ado.net-entity-data-model c# entity-framework sql-server


I'm using the Entity Framework to generate the classes and functions in C# I need to interact with the SQL server.

For reference, here's one of my tables:



CREATE TABLE [dbo].[Area](
    [ID] [bigint] identity (1, 1) primary key,
    [Name] [nvarchar](100) NOT NULL

After running the Entity Data Model Wizard (using 'EF Designer from database'), my project has the edmx file and a few new .cs files, but it seems like it's not generating everything it needs.

In my DatabaseEntities class, for example, I've got:

    public virtual DbSet<Area> Areas { get; set; }

However, there's no definition for the type 'Area' (along with three other missing types). I'm also missing the functions for stored procedures.

I've tried deleting the new files and re-running the Model Wizard, but I get the same result.

Has anyone else run into this?


I've noticed during the last few attempts that I'm also getting an error when the wizard runs: "The Entity Framework package not installed on project". However, it's still generating the edmx and the model.context when I click past it.

I've had the same problem with both Entity Framework versions 6.0.0 and 6.1.2.

Reinstalling the framework had no effect on the problem(s).


Uninstalling nuget and reinstalling the latest version allowed me to install EntityFramework via nuget without error. However, now the ADO.NET data model is missing from the Add New Item dialogue.

2/18/2015 11:45:43 PM

Accepted Answer

There were several steps involved in what I did, and I have to give some credit to the people who commented below the question.

1) I uninstalled nuget package manager and reinstalled the latest version (apparently mine was not fresh). This allowed me to install EntityFramework via nugget with no errors or rollback messages.

2) I'm not sure if this helped or not, but I also reinstalled Entity Framework Tools for Visual Studio via Microsoft's website. I'm still not sure if it's necessary to have both.

3) The ADO.NET Entity Data Model template appeared to be missing from the Add New Item dialogue. After selecting "Add -> Component" instead of "Add -> New Item", it then mystically appeared under both lists.

Once that was done, I was able to run EF Designer and everything generated with no problem.

2/19/2015 12:19:10 AM

Popular Answer

Make sure the table has a key column. It will not generate the view if there is no key column in a table.

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow