Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep Database Content On Model Change

Using the code-first approach available in the new 4.1 RC.

Is there any way to persist the current data stored in a database when the mode changes? The database is created by the entity framework, and usually the database is dropped and recreated on model changes.

Obviously as soon as the model is changed it will not be possible to use the context object to connect to the database to retrieve the data, so what are the options?

like image 868
Kasper Holdum Avatar asked Mar 28 '11 18:03

Kasper Holdum


1 Answers

Code first doesn't support database migration / evolution yet. If you want to do incremental DB development use model first (EDMX) with DbContext Generator T4 template and Entity designer database generation pack which is able to create diff. scripts from the model.

like image 149
Ladislav Mrnka Avatar answered Oct 12 '22 00:10

Ladislav Mrnka