I am investigating EF Codefirst. While I like the Code/SB sync benefit, it does trouble me that the tables are dropped and data lost. In reality my dev DB could have quite a bit of test data. Is there not an alternative to this “table dropping” like the use of “Alter Table” etc.
It puts me off EF Code First.
Thanks,
Ed
Apparently you didn’t do much investigating. Apart from the fact there are lots of ways to do code first without dropping tables (such as manually making the changes), Code First Migrations has been out for quite some time.
http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx
http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-automatic-migrations-walkthrough.aspx
It’s not like this is any different from any other way of doing things. You have to manually change your database when using Database first as well, and you have to drop your tables to regenerate your database in Model First.
This is not anything specific or strange about code first. It’s the way it works for every orm technology.