none
Update model from database wizard ignores some random tables RRS feed

  • Question

  • I have an existing DB and an existing EMDX (DB-first). It's been 5 years and about 200 tables without a problem.

    All of a sudden, this strange problem appears :
    When doing "Update Model from Database", the wizard removes the table mapping for 5 tables. Then I see the Error 11007 + Error 11008 (2 of them were mapped to many-to-many associations).

    If I retry, the tables are listed in the "Add" tab. So Visual Studio sees them. But when I try to add them, nothing happens ! Now the funny part: renaming the table corrects the problem !

    I tried in another brand-new solution/project, create a new Entity Data Model, the problem remains. But always with the same 5 tables.
    About a month ago I had the same problem with one table, and renamed it to work-around. I can't do this for all my tables.

    Any ideas what could cause a particular table name to be ignored by the wizard ??

    More info: https://stackoverflow.com/questions/47133193/ef-dbfirst-table-gets-removed-from-model

    Problem reported here: https://github.com/aspnet/EntityFramework6/issues/418


    Thursday, November 30, 2017 1:57 PM

Answers

  • OKaaay I solved it. Soo weird.
    I had created "separator" tables with names formed with 20 underscores. Like this : schema._________________________
    So I had "separators" between my schemas in SSMS. These dummy tables were not mapped of course.
    I removed them and voilà. Problem disappeared !?
    Friday, December 1, 2017 10:38 AM

All replies

  • Hi Michaël van Kerckhoven,

    >>Any ideas what could cause a particular table name to be ignored by the wizard ??

    According to your description and error message, it seems that the entities type in the conceptual model is not mapped to the data source. please map the entity type to the data source by manually, for more information, the following document provide 8 steps for your reference.

    https://msdn.microsoft.com/en-us/library/bb738478%28v=vs.103%29.aspx?f=255&MSPPError=-2147217396

    In addition, you could also try another workaround.

    1. rename the tables name.

    2. update data model from database with new tables name.

    3. delete the model from edmx file.

    4. rename the tables name back to original name.

    5. update data model from database.

    If the issue still exists, could you please share a simple demo which could reproduce the issue via OneDrive.

    Note: Please remove related privacy information before you share the sample.

    Best regards,

    Zhanglong Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 1, 2017 7:02 AM
    Moderator
  • Thank you for your response.

    Additional notes/answers to your suggestions:

    >> it seems that the entities type in the conceptual model is not mapped to the data source

    The entity was mapped. When I did the update, the wizard REMOVED the mapping. Yet, the table did not change PLUS it was listed in the refresh tab of the wizard

    >> rename the tables name back to original name

    Already tried that.

    I created a brand-new solution. I added a brand-new EMDX file (EF6). I added all my database in it. The same 5 tables did not import.

    Also, I exported my database in a SQL Script. I created a new database with the script. The problem is still there !!

    For now I'm creating a virtual machine, I'm going to see if the problem is the same in it.

    Friday, December 1, 2017 8:56 AM
  • OKaaay I solved it. Soo weird.
    I had created "separator" tables with names formed with 20 underscores. Like this : schema._________________________
    So I had "separators" between my schemas in SSMS. These dummy tables were not mapped of course.
    I removed them and voilà. Problem disappeared !?
    Friday, December 1, 2017 10:38 AM