Reputation: 7856
I have the usual approach to create an entity data model and have all the models ready. On initial connection or in setting up the database, we normally do the "Generate Database from Model..." option which just generates a SQL script.
My question is simple: After initial creation, how can we update the database if we make changes to the data model?
The "Generate Database from Model" option isn't really the way to go since it drops existing and creates new tables.
I reached this promising tool while scouring stackoverflow: http://visualstudiogallery.msdn.microsoft.com/df3541c3-d833-4b65-b942-989e7ec74c87/
But that's for Visual Studio 2010 and it looks like the creators have no plans to deploy it to 2012.
Anyone found a straightforward way to do it? Thanks!
Upvotes: 0
Views: 2389
Reputation: 9296
I am not sure how much help this would be especially because it is a different approach. Basically, instead of using your approach I prefer Code-First. EF team has released EF PowerTool
extension for VS2010 and VS2012 (http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d). By right clicking on a project you can reverse engineer your database. This will create POCO classes and mappings, together with an implementation of DbContext. After that you can enable migrations and any change you make to your model and mappings you can submit back to the server.
Upvotes: 1