BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Code-First Migrations Released With Entity Framework 4.3

by Roopesh Shenoy on Feb 21, 2012 |

Entity Framework 4.3 release finally brings the Migrations feature to Developers, without having to depend on separate pre-release binaries.

What is EF Migrations? If you are using Entity Framework Code-First, Migrations allows you to update your database schema to reflect your POCO classes without having to drop and recreate them. This involves DDL statements to create new tables/columns, alter existing ones, etc. which get generated. The feature has been available to developers for a while as a Nuget package (which can be still used if you are using a lower version of Entity Framework for legacy reasons), but not formally supported by Microsoft.

For a while, this has been one of the most requested features in Entity Framework.

Separate walkthroughs for Automatic Migrations and Code Based migrations are present on the MSDN Team blog. The first one uses features inside Visual Studio along with code-based migration, whereas the second one uses a pure code-only approach. Ideally you only require code based migrations in cases where you want to override default behavior for e.g. renaming columns instead of dropping and creating a new one or providing a default value for the added column.

Migrations also allows you to create deployment scripts to be used against the production database.

Entity Framework is an Object-Relational Mapper provided by Microsoft for .NET applications.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT