首页 > 解决方案 > 为什么 EF6 说我需要应用已经应用的迁移?

问题描述

我正在尝试通过在 PMC 中运行以下命令来添加迁移add-migration usernotes
无论如何,我在 _MigrationHistory 表中看到了我的所有迁移,但是当我尝试运行命令说
Unable to generate an explicit migration because the following explicit migrations are pending: <all my migrations that were already applied>. Apply the pending explicit migrations before attempting to generate a new explicit migration
我尝试过
的指定配置名称时出现错误-ConfigurationTypeName CONFIGNAME(我的配置名称与那个 fyi 不同)。
Enable-Migration结果 PMC 告诉我迁移已启用
卸载并重新安装 EF
设置启动项目
重建项目
移动所有迁移,以便 EF 不再看到它们
指定连接字符串-ConnectionString

标签: sql.netentity-framework.net-coreentity-framework-6

解决方案


好的,所以连接字符串的工作方式是它在启动时拼凑在一起,当我把它们全部放在一起时,像这样:public string ConnStr = "Server=sever_name;Database=db_name;User Id = userid; Password=password;";,它解决了这个问题。


推荐阅读