C# – Entity Framework: How to update database when modifying Model

ado.netcentity-frameworkentity-framework-4sql server

In Entity Framework 4 there are the options "Update Model from Database" and "Generate Database from Model". But what I'm missing is an option like

Update Database from Model

which reflects the changes made in the model (e.g. adding a new Property or Navigation-Property) by modifying the database schema (e.g. adding a new column). without losing its content.

Does someone know a way to achieve this or is there a t4 template that can perform a schema update without dropping existing tables? (I'm using Visual Studio 2010, .Net 4.0 and SQL Server 2008)

Thanks

Best Answer

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