Entity Data Model Wizard Not Showing New Tables

I had a similar problem with Code First. I followed all the steps mentioned on the question, but the model for the table was not being generated.

  • Build, Clean Solution
  • Delete conn strings from in web.config
  • Delete all files in Models folder
  • Right click on Models folder, Add, New Item
  • Select ADO.NET Entity Data Model
  • Add name to Model
  • Select Code First from database
  • Select New Connection
  • Save Connection Settings in web.config - Checked

I found out it was because the table did not have a primary key. So I altered the table

[OrderId] [int] not null identity(1,1) primary key,

and it worked.

In case anyone runs into this, I hope it helps.


In the Entity Data Model Wizard, on the "Choose Your Data Connection" screen, I chose "New Connection" rather than hitting "Next" with the existing connection. Choosing the server name and database name and redoing the connection seems to refresh the view, and now the new tables have shown up.

I had a feeling it was going to be some small, ten-second thing I was missing.

UPDATE:

Redoing the connection made the new tables available, but not the stored procedures. Here's how I fixed it.

In the Model Wizard, choosing "Code First From Database" won't include stored procedures, for whatever reason. For me, the correct option was "EF Designer from Database". Not only did I get the new tables AND stored procedures, but it also generated the edmx file that the first option wouldn't create.


I had this problem and it turned out to be the SQL user being used did not have select access to the newly created tables.

I ran GRANT SELECT ON [tablename] to [sqluser] on the database for all the new tables. You could also just add the sql user to a server role like sysadmin.

Running Update Model from Database then showed the new tables.