Entity Data Model Designer not showing tables

entity-framework visual-studio-2010

Question

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.

1
11
6/12/2012 1:23:15 AM

Accepted Answer

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>
14
8/12/2012 7:27:33 PM

Popular Answer

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!



Related Questions





Related

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