none
MVC 3 problem when adding a new view to the database RRS feed

  • Question

  • Hello

    Using database first in MVC 3, I create a SQLServer 2008r2 database.  I add the Entity Model, and the wizard automatically generates the edmx model. 

    We then add the EF 5 DB Context generator.  All is well.

    Then I go back to the sqlserver database and add a view, select the EDMX in the model within VS.  I do a 'update model from database', and it does not read the keys properly.  I personally would like to see these views as read only, so it's not usually a problem, but I know you can manually click on the properties of the model, and tell it which columns are and are not entity keys to fix it.

    The real problem is if you change a view or views in the DB, the model does not update properly.  I understand the reasoning behind not deleted existing properties, but _all_ of my view classes in the EDMX are 'unfixed'.  Basically, the wizard re-breaks the views.

    MVC 3 has now been out for a few years, and I'm having to deal with serious issues because every time I add a new or modify a new, it completely destroys the model. 

    Is there a fix, is something wrong with my VS, my DB, or something else?

    Does MVC 4 and VS 2012 fix this?

    Please help.

    Thank you very much.

    David A. Diaz


    Night Skywatcher a/k/a David Diaz

    Monday, March 4, 2013 9:59 PM

Answers