[英]Entity Framework 5 Code First Downgrade Migration
我们将Entity Framework 5与Code First一起使用。 我们已经编写了一个IDatabaseInitializer,用于将数据库降级到以前的版本。
因此,我们希望在最后的降级步骤中撤消初始数据库设置步骤。 即数据库与第一次安装之前一样。 如何使用实体框架迁移执行此操作? 不能删除模式,因为模式不是空的。
http://msdn.microsoft.com/zh-CN/library/hh829363(v=vs.113).aspx写道:
public void Update()
Updates the target database to the latest migration.
public override void Update(string targetMigration)
targetMigrationType: System.String / The migration to upgrade/downgrade to.
我的问题是,我没有要删除的第一步的targetMigration名称。 我尝试使用“ 0”,但是它不起作用。 当我使用Update()时,我的数据库被设置为不需要的最新版本。 表现如何?
它是
DbMigrator.InitialDatabase
与“ 0”相同。 不知道,为什么它最初不能与“ 0”一起使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.