简体   繁体   English

Visual Studio 2015和实体框架迁移不起作用

[英]Visual Studio 2015 and Entity Framework Migrations not working

We are using Visual Studio 2015 Update 1 and Entity Framework 6.1.3. 我们正在使用Visual Studio 2015 Update 1和Entity Framework 6.1.3。 Also we are following the Code-First approach and are using Entity Framework Migrations to respond to schema changes. 另外,我们正在遵循“代码优先”方法,并且正在使用“实体框架迁移”来响应架构更改。 Since updating to Visual Studio 2015, some fellow developers can not add any Entity Framework Migrations. 自从更新到Visual Studio 2015以来,一些其他开发人员无法添加任何实体框架迁移。 When executing 'Add-Migration', Entity Framework does not find any migrations in the project and asks you to turn on migrations. 在执行“添加迁移”时,Entity Framework在项目中找不到任何迁移,并要求您打开迁移。

Anyone experienced a similar issue and knows a solutions? 任何人都遇到过类似的问题并且知道解决方案吗? Many thanks in advance! 提前谢谢了!

We were able to determine the root cause and fix the issues. 我们能够确定根本原因并解决问题。

Issues: 问题:

  • Avoid having more than one classes derived from DbContext in an assembly 避免在程序集中具有多个从DbContext派生的类
  • We used the Nu-Get package EntityFrameworkWithHierarchyId, which is not just an extension, but a fork of the Entity Framework. 我们使用了Nu-Get包EntityFrameworkWithHierarchyId,它不仅是扩展,而且是实体框架的分支。 When we replaced all dependencies to EntityFramework by EntityFrameworkWithHierarchyId, the issue disappeared. 当我们用EntityFrameworkWithHierarchyId替换EntityFramework的所有依赖项时,问题消失了。 It properly occured by different install routines in the provided PowerShell Scripts and the different Assemlblies 它是由提供的PowerShell脚本中的不同安装例程以及不同的组件正确发生的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2015 RC实体框架6.1.3迁移错误 - Visual Studio 2015 RC Entity Framework 6.1.3 Migrations Error 首先是实体框架代码,对于控制台Visual Studio 2015不再可用 - Entity Framework code first, Not working anymore for Console Visual Studio 2015 为什么在Visual Studio 2015 Professional中使用实体框架无法映射 - Why mapping is not working using Entity Framework in visual studio 2015 professional 实体框架崩溃了Visual Studio 2015吗? - Entity Framework crashed Visual Studio 2015? 在Visual Studio 2015中安装实体框架失败 - Installing Entity Framework fails in Visual Studio 2015 Visual Studio 2019 实体框架启用迁移错误 - Visual Studio 2019 Entity Framework Enable Migrations Error 在Visual Studio 2015中安装实体框架缺少支持的标签 - Installing entity framework in visual studio 2015 missing supported tags 实体Framework6 Visual Studio 2015 Mysql问题 - Entity Framework6 Visual Studio 2015 Mysql Problems 实体框架7,Visual Studio 2015,控制台命令不起作用 - Entity framework 7, visual studio 2015, console commands don't work 无法使用Entity Framework和Visual Studio 2015添加迁移 - Unable to add migration using Entity Framework and Visual Studio 2015
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM