none
Table first approach - Update Model from Database is not properly updating

    Question

  • Hello,

     

    Here is my problem.  We have a database that has three schemas (plant, dbo, Sale).  We originally generated the model directly from the database.  We then renamed in the EF designer the entities.  For example since PlannedOrder was in the Sale schema w renamed PllanedOrder to SalePlannedOrder.  Now when we do a update from the database the changes don't usually get changed in the edmx file.  For instance one column goes from nullable to not nullable but that changes doesn't get translated over to the edmx file.  How can we get it to be properly changed when we do a update from the database?

     

     

    Thanks in advance!

    Wednesday, October 26, 2011 2:01 PM

Answers

  • Now when we do a update from the database the changes don't usually get changed in the edmx file.  For instance one column goes from nullable to not nullable but that changes doesn't get translated over to the edmx file.  How can we get it to be properly changed when we do a update from the database?

    Hi,

    The built-in "update model" wizard don't detect some types of changes, and for many types of changes it will update the SSDL (storage model) portion of the model without updating the CSDL (conceptual model). The diagram you see in the designer is the CSDL model. After running the "update model from database" wizard you need to manually apply changes to the CSDL and update mappings where needed.

    There are third party tools that can detect and make these changes for you; one such tool is the "model comparer" in my add-in Huagati DBML/EDMX Tools. You can download it from http://huagati.com/edmxtools/ and get a trial license from the same site, if you want to try it out.

    Here is an introduction to it + screencast demo:

    http://huagati.blogspot.com/2010/07/introducing-model-comparer-for-entity.html

    Hope this helps!


     
       Cool tools for Linq-to-SQL and Entity Framework 4:
     huagati.com/dbmltools - Visual Studio add-in with loads of new features for the Entity Framework and Linq-to-SQL designers
     huagati.com/L2SProfiler - Runtime SQL query profiler for Linq-to-SQL and Entity Framework v4
    • Marked as answer by Lavagin Wednesday, November 02, 2011 8:50 PM
    Monday, October 31, 2011 6:02 AM

All replies

  • Hi Lavagin,

    You can use "Refresh" to refresh the new changes in datatable.

    http://msdn.microsoft.com/en-us/library/cc716705.aspx

    another way--->delete entity from edmx--->update from database--> readd

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, October 27, 2011 5:51 AM
    Moderator
  • Hi,

    I am writing to check the status of the issue on your side.Would you mind letting us know the result of the suggestions?

    If you need further assistance, please feel free to let me know.I will be more than happy to be of assistance.

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, October 31, 2011 2:15 AM
    Moderator
  • Now when we do a update from the database the changes don't usually get changed in the edmx file.  For instance one column goes from nullable to not nullable but that changes doesn't get translated over to the edmx file.  How can we get it to be properly changed when we do a update from the database?

    Hi,

    The built-in "update model" wizard don't detect some types of changes, and for many types of changes it will update the SSDL (storage model) portion of the model without updating the CSDL (conceptual model). The diagram you see in the designer is the CSDL model. After running the "update model from database" wizard you need to manually apply changes to the CSDL and update mappings where needed.

    There are third party tools that can detect and make these changes for you; one such tool is the "model comparer" in my add-in Huagati DBML/EDMX Tools. You can download it from http://huagati.com/edmxtools/ and get a trial license from the same site, if you want to try it out.

    Here is an introduction to it + screencast demo:

    http://huagati.blogspot.com/2010/07/introducing-model-comparer-for-entity.html

    Hope this helps!


     
       Cool tools for Linq-to-SQL and Entity Framework 4:
     huagati.com/dbmltools - Visual Studio add-in with loads of new features for the Entity Framework and Linq-to-SQL designers
     huagati.com/L2SProfiler - Runtime SQL query profiler for Linq-to-SQL and Entity Framework v4
    • Marked as answer by Lavagin Wednesday, November 02, 2011 8:50 PM
    Monday, October 31, 2011 6:02 AM