2

In mySql Workbench there's a possibility to "sync" the model with the DB and vice versa. Is there a function like this in EF? I've added som entities and I'd like it to get reflected in the DB. Do I really have to regenerate the entire DB and loose data?

Thanks

Phil
  • 3,934
  • 12
  • 38
  • 62
  • That is possible with 3rd party tools. My company makes an add-in that gives you two-way incremental comparison and sync between DB, SSDL, and CSDL. See http://huagati.blogspot.com/2010/07/introducing-model-comparer-for-entity.html for an intro screencast. You can download the add-in from http://huagati.com/dbmltools/ and get a trial license from the same site if you want to take it for at test spin. – KristoferA Oct 17 '10 at 15:02

2 Answers2

2

Sadly there is no easy way AFAIK to do this today.

One way to handle this is to generate the DDL and then cut and paste the new sections into SQL Server Management Studio and run them there. If you want to maintain scripts for each release of the database you'll need to take an approach like this too.

See also: Database migrations for Entity Framework 4

PS The EF Power Pack: http://msdn.microsoft.com/en-us/data/ff830362.aspx may help. It says "The second useful feature related to model-first the ability to update an existing database and synchronize the model with it. This allows you to make changes to the model that can be deployed to the database without data loss."

Community
  • 1
  • 1
Ian Mercer
  • 38,490
  • 8
  • 97
  • 133
-1

if you are using the VS2010 then in Select your edmx designer ( designer showing tables) and right click it will show the update model option.