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
Right-click anywhere on the design surface, and select Update Model from Database. In the Update Wizard, select the Refresh tab and then select Tables > dbo > Student. Click Finish.
Right-click anywhere on the design surface, and select Update Model from Database... In the Update Wizard, select the Refresh tab and select your table then click Finish button.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With