Ger*_*vis 11 entity-framework-6 asp.net-core
我创建了一个新的类库(包)项目(在VS 2015 RC之前使用了更糟糕的asp.net类库名称来表示数据层.只是要清楚这是更新的kproj样式结构.
将EF 6.1.3添加到project.json.目前仅针对DNX451.
"dependencies": {
"EntityFramework": "6.1.3"
,"Moq": "4.2.1502.911"
},
Run Code Online (Sandbox Code Playgroud)
创建初始模型类并使用AlwaysCreate数据库初始化程序一切正常.现在需要切换到迁移,以便在包管理器控制台中使用Enable-Migrations并获得:
Enable-Migrations : The term 'Enable-Migrations' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Enable-Migrations
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Enable-Migrations:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)
对于EF7迁移,迁移命令不支持包管理器.相反,有一个新的ef命令在dnu中运行,但是新进程只适用于EF7而不是EF6吗?
为什么包管理器认为即使引用了EF6,Enable-Migrations仍然无效?
为什么尽管引用了 EF6,包管理器仍认为 Enable-Migrations 无效?
因为我假设并且非常确定 ASP.NET 5 项目不会调用包内的安装和卸载 PowerShell 脚本,而 EF 6 包必须将迁移命令添加到包管理器控制台。您最好的运气是尝试将命令行工具(我相信它称为 migrate.exe,不确定)集成到 EF6 NuGet 包中。
| 归档时间: |
|
| 查看次数: |
3910 次 |
| 最近记录: |