Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Data Model Designer not showing tables

I am trying to create a Entity Data Model via an existing database,

So i follow these steps in visual studio 2010:

  1. Add new Item->Entity Data Model
  2. Select "Generate From Database"
  3. Select a connection string, test the connection string and its ok
  4. Select the tables, stored procs etc to import, no tables show up at this point, but i do check the "tables" selection - im assuming tho that it should list my tables here.

Then after these steps the Entity Data Model visual tool (ie. double click on .edmx file) shows no tables - i have tables in my database, and the username and pass im using to connect has permissions to access these tables ok.

thanks.

like image 202
Marty Avatar asked Jun 12 '12 01:06

Marty


2 Answers

Open your edmx file in a text editor. If you see the tables in the file but not in the designer, try clearing out all the EntitySet nodes and EntityType nodes, save the file, then go back to Visual Studio and try the Update Model from Database again.

<edmx:StorageModels>
    <Schema Namespace="myModel.Store">
        <EntityContainer Name="MyModelStoreContainer">
            delete-> <EntitySet Name="Table1" ... />
            delete-> <EntitySet Name="Table2" ... />
        </EntityContainer>
            delete-> <EntityType Name="Table1">...</EntityType>
            delete-> <EntityType Name="Table2">...</EntityType>
  </Schema></edmx:StorageModels>
like image 77
James Lawruk Avatar answered Sep 28 '22 03:09

James Lawruk


I also had a similar problem. But in my case, it was due to missing Primary Key in the selected table. So, I added a primary key, and updated the model from the Database. After that, I could see the table, and all the columns!

like image 24
user2415339 Avatar answered Sep 28 '22 02:09

user2415339