entity framework 迁移出错

来源:互联网 发布:python datetime 分钟 编辑:程序博客网 时间:2024/05/29 12:46

Q:

当我输入add-Migration Chap5命令后,返回错误如下: Unable to generate an explicit
migration because the following explicit migrations are pending:
[201312260629440_InitialCreate]. Apply the pending explicit migrations
before attempting to generate a new explicit migration. 请问这个问题怎么解决

A:

这是存在悬挂的migration,可以尝试在[201312260629440_InitialCreate] 中把 public override void Up() 方法中的操作全注释后再运行一次update-database,就是什么也不做,单纯执行完悬挂的migration。

之后再执行你需要的add-Migration操作

0 0
原创粉丝点击