【问题标题】:Entity Framework migrate.exe not working after updating to AspNet.Identity实体框架 migrate.exe 在更新到 AspNet.Identity 后不起作用
【发布时间】:2015-12-14 18:30:49
【问题描述】:

自从更新我的解决方案以使用 ASPNET 身份而不是旧成员身份后,用于更新数据库架构的 migrate.exe 突击队停止工作。唯一的主要变化是我的 Context 现在继承自 IdentityDbContext,而之前它是从 DbContext 继承的。

在包管理器控制台上运行 update-database 一切正常,但在命令行上使用 migrate.exe 不再起作用。我得到了错误:

System.Data.Entity.Migrations.Infrastructure.MigrationsException: No migrations configuration type was found in the assembly 'SampleProject.Repository.EF'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration).

与往常一样,我有一个用于迁移的 Configuration.cs 文件,并且在运行“启用迁移”时建议我收到一条消息,指出该项目已启用迁移。

有谁知道问题出在哪里?

谢谢

【问题讨论】:

  • 尝试将开关添加到您的命令中,以识别上下文的位置。 stackoverflow.com/questions/18126711/…
  • 似乎根本没有关系。在我的案例中,上下文和迁移位于同一个项目中。如果通过包管理器控制台运行“更新数据库”,它总是工作正常,迁移工作,所以我有一个迁移文件夹和一个配置文件。问题是在命令行上运行“migrate.exe”时。
  • 如果您可以尝试重置迁移(删除文件夹和数据库表,重新启用,添加,更新)。 stackoverflow.com/questions/10718648/…

标签: asp.net-mvc entity-framework asp.net-identity dbcontext entity-framework-migrations


【解决方案1】:

只是对解决方案的快速更新。 运行 migrate.exe 时出现 DLL 版本冲突。 我正在使用我的 Web 项目的输出(其中还包含 EF 项目的 DLL)。 我更新了它以使用我的 EF 项目的 bin 内容,它工作得很好。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-11
    • 1970-01-01
    • 2011-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-28
    相关资源
    最近更新 更多