2

I have a data model created, from which I generated a database, if I have to make any changes in my model, how do I update the database generated?. The RE-generate process is useless for me, because database already contain data. I'm using Visual Studio 2010, EF 4.0, SQL 2008.

Thanks in advance.

1

1 Answer 1

0

Basically, you can change your model and DB manually (create/change columns and tables by hand, using SQL Managemets Studio), just delete hash value in EdmMetadata table and EF will not track if your DB is in sync with model anymore. This is quick and dirty solution and you need to take care to keep model in sync with db manually.

Alternatively, you can update to EF 4.3 and take advantage of migrations feature. There are detailed walkthroughs available on: http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx and http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-automatic-migrations-walkthrough.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.