Entity Framework: how to update the database when the model changes

Entity Framework 4 has the options "Update model from database" and "Create database from model". But what I am missing is an option, for example

Update database from model

which reflects the changes made to the model (for example, adding a new Property or Navigation-Property) by changing the database schema (for example, adding a new column). without losing its content.

Does anyone know a way to achieve this, or is there a t4 template that can perform schema updates without discarding existing tables? (I am using Visual Studio 2010, .Net 4.0 and SQL Server 2008)

thanks

+6
c # sql-server entity-framework entity-framework-4
source share
1 answer

The best way I've found so far is to update the database first, for example, add a column to the table and then update the model from the database. This works well for small changes.

+1
source share

All Articles