码迷,mamicode.com
首页 > 其他好文 > 详细

Entity Framework Code-First(20):Migration

时间:2016-07-05 19:00:13      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

Migration in Code-First:

Entity framework Code-First had different database initialization strategies prior to EF 4.3 like CreateDatabaseIfNotExists, DropCreateDatabaseIfModelChanges, or DropCreateDatabaseAlways. However, there were some problems with these strategies, for example if you already have data (other than seed data) or existing Stored Procedures, triggers etc in your database, these strategies used to drop the entire database and recreate it, so you would lose the data and other DB objects.

Entity framework 4.3 has introduced a migration tool that automatically updates the database schema, when your model changes without losing any existing data or other database objects. It uses a new database initializer called MigrateDatabaseToLatestVersion.

There are two kinds of Migration:

  1. Automated Migration
  2. Code based Migration

Learn about automated migration in the next section.

Entity Framework Code-First(20):Migration

标签:

原文地址:http://www.cnblogs.com/purplefox2008/p/5644369.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!