首页 > 其他 > 详细

Entity Framework Code-First(20):Migration

时间:2016-07-05 18:56:55      阅读:117      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!