Update the database structure from entity Framework Model RRS feed

  • Question

  • Hello !

    I'm using VB.net , EF6 with SQL server 2008R2 database.

    This is the situation :

    I have created the application. Using wizard I have created the Entity model from an existing database.
    A client start using this application using this database on his computer.

    After some month , I made some modifications on the database and I have updated the model on my application .

    Now I have a new .exe file that has the new model from the new database.

    I put the new .exe file on the client computer.

    Now on his computer : The .exe file has the new database model , but the sql server database has the old structure.

    I want to know : Is possible to update the database structure from the entity model on application ?

    I want to add a command on application that can make ( if is possible ) this update , so the database become up to date according to entity model ?

    Thank you !

    Friday, January 30, 2015 4:01 PM

All replies

  • Hello,

    From your description, it seems that you want to apply a migration for a database first approach, unfortunately, as far as I know, EF Migrations is a product targeted at Code First and doesn't support Database First operations. A workaround I know is to use update-scripts. If your database structure would be changed frequently, it is recommended to use the Code First approach which would have a better workaround for migrations, for details, you could refer to this video,  and with the Entity Framework Power Tools, it is easy to create a code first based project form an existing database.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 2, 2015 6:35 AM