2

I'm using Entity Framework Code First. The database initialization works great for creating the database and tables.

I was wondering if there's a way to make the process less destructive... rather than issuing DROP / CREATE statements when the schema changes, is there any way (via an off-the-shelf Initializer, or otherwise) to issue ALTER statements to update my schema?

2 Answers 2

3

You should look into Code First Data Migrations, I've not used it myself but I believe it's what you are looking for.

http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-released.aspx

To help those that come along later, you should be able to follow these instructions to get it all setup : http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx

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

1 Comment

Thanks, I think that is what I'm looking for - heres a good link that helped me get it set up. Please add it to your answer for those who come later and I will accept your answer. blogs.msdn.com/b/adonet/archive/2012/02/09/…
0

I think this might help: http://www.entityframeworktutorial.net/code-first/database-initialization-strategy-in-code-first.aspx There is an example of using custom method to initialize data.

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.