BT

InfoQ Homepage News Code-First Migrations Released With Entity Framework 4.3

Code-First Migrations Released With Entity Framework 4.3

Bookmarks

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.

Rate this Article

Adoption
Style

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.

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

Community comments

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

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

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.