0

I have an ASP.NET MVC app built using NET 4.5 and Entity Framework database first. I am using Visual Studio 2013.

Now I am trying to update the edmx from database. Basically I am trying to add a table to the edmx diagram so I follow below steps:

  1. Open edmx diagram from Visual Studio

  2. Choose the option to update diagram from database

  3. Navigate to 'Add' Tab in order to add the table, but table is not being shown there..... Also the auto-generated cs file does not exist in the folder.

    So I go to Update Tab, and I can see that table is being shown there, however table is not being shown in the diagram.

So I decide to open edmx file using an editor and I remove all the entries for that table (It seems like somebody deleted the table in the past but entries in the edxm were not removed and they still were there). Anyway, after that I follow below steps:

  1. Open edmx diagram again
  2. Choose option update from database and go to Add Tab. Now table is shown there.
  3. Select the table I am interested in
  4. Press button finish to proceed to update the edmx diagram.

Now I look for the table into edmx diagram but table is not there, it is not being added... and the auto-generated cs file does not exist in the folder.

So how can I add the table to the edmx diagram?

Community
  • 1
  • 1
Willy
  • 9,848
  • 22
  • 141
  • 284
  • Not that it is going to help you, but code first > database first. EDMX sucks imo. – Tanveer Badar Mar 12 '20 at 19:05
  • There are cases where tables are added to the entity framework model but aren't visible on the designer. The most common one would be a mapping table that has two columns only that maps directly to two different tables. Entity framework will create the relationships between the two tables but wont show the table mapping them. The table has been added to the model though. – Christopher Townsend Mar 12 '20 at 19:51
  • @TanveerBadar - I have found CodeFirst and DatabaseFirst both have their pros and cons. – Christopher Townsend Mar 12 '20 at 19:55

0 Answers0