[英]Add migration - Both Entity Framework Core and Entity Framework 6 are installed
I have a solution with multiple projects one of them with EF 6 and another one with entityframeworkcore.我有一个包含多个项目的解决方案,其中一个使用 EF 6,另一个使用 entityframeworkcore。
The migrations were working fine before adding EF6 project, but now I can't use the migration's command : add-migration 'anything'<\/code>
在添加 EF6 项目之前,迁移工作正常,但现在我无法使用迁移的命令:
add-migration 'anything'<\/code>
Both Entity Framework Core and Entity Framework 6 are installed. Entity Framework Core 和 Entity Framework 6 都已安装。 The Entity Framework Core tools are running. Entity Framework Core 工具正在运行。 Use 'EntityFramework\\Add-Migration' for Entity Framework 6.对实体框架 6 使用“EntityFramework\\Add-Migration”。
For the project with EF6 I can add a migration using this way:
EntityFramework\\Add-Migration 'anthing_here'<\/code> , but I can't add a migrations to the project with EFCore using this way.
对于使用 EF6 的项目,我可以使用这种方式添加迁移:
EntityFramework\\Add-Migration 'anthing_here'<\/code> ,但我无法使用这种方式向使用 EFCore 的项目添加迁移。
Any suggestions ??有什么建议 ??
"
For EF6:对于 EF6:
EntityFramework\Add-Migration <MIGRATIONNAME>
For EF Core:对于 EF 核心:
EntityFrameworkCore\Add-Migration <MIGRATIONNAME>
I had this same scenario happen on our project that spans now ~20 years in history.我在我们的项目中也发生了同样的情况,该项目已经有 20 年的历史了。
It has everything from Web Forms<\/strong> , to latest .Net Core<\/strong> technologies.它拥有从Web 表单<\/strong>到最新的.Net Core<\/strong>技术的所有内容。 Depending on luck, I would sometimes get that PackageManagerConsole<\/code> was using
EFCore<\/code> sometimes
EF6<\/code> .
取决于运气,我有时会发现
PackageManagerConsole<\/code>有时使用
EFCore<\/code>
EF6<\/code>
I was not happy that I had to use prefixes like above answer stated so I dug deeper.我很不高兴我不得不使用上述答案中的前缀,所以我挖得更深。
If you run command
Get-Module<\/code> in your
PM> PackageManagerConsole<\/code> you should get list of active modules:
如果您在
PM> PackageManagerConsole<\/code>中运行命令
Get-Module<\/code> ,您应该获得活动模块的列表:
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 6.4.4 EntityFramework6 {Add-EFDefaultConnectionFactory, Add-EFProvider, Add-Migration, Enable-Migrations...}
Script 5.0.10 EntityFrameworkCore {Add-Migration, Drop-Database, Enable-Migrations, Get-DbContext...}
Script 2.0.0.0 NuGet {Add-BindingRedirect, Find-Package, Get-Package, Get-Project...}
Script 0.0 profile
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.