【发布时间】:2015-12-02 12:34:18
【问题描述】:
我正在使用带有个人用户帐户的 ASP.NET 5 Web 应用程序模板(使用 EF7 和 MVC 6),我遇到以下问题:
当我将自己的 DBSet 添加到 ApplicationDbContext 类中,然后转到尝试使用这个新 DBSet 的页面时,它不起作用,我得到了这个:
A database operation failed while processing the request.
SqlException: Invalid object name 'WallMessageModel'.
There are pending model changes for ApplicationDbContext
Scaffold a new migration for these changes and apply them to the database from the command line:
dnx . ef migration add [migration name]
dnx . ef migration apply
现在,当我运行这些命令或我得到的任何“dnx”命令时:
CategoryInfo NotSpecified: Error: Unable t...stemindsWebsite:String, RemoteException FullyQualifiedErrorId : NativeCommandError
如果我试图运行任何“k”命令我得到:
CategoryInfo : ObjectNotFound: k:String, CommandNotFoundException FullyQualifiedErrorId : CommandNotFoundException
我正在使用"EntityFramework.SqlServer": "7.0.0-beta5", "EntityFramework.Commands": "7.0.0-beta5"
我尝试使用 7.0.0-* 版本,但它仍然不适合我。你能告诉我我做错了什么吗?
基本上,我认为我的机器上没有正确安装 EF 命令(通过 Visual Studio 2015/PowerShell)。但是,似乎没有任何参考资料显示如何安装这些(使用 EF7 时不应该将它们内置到 VS2015 中吗?)。
【问题讨论】:
-
安装最新的候选版本 RC1。不要乱用beta5。发生了太多变化。
-
你能澄清一下吗?您使用的是哪个“控制台”?包管理器控制台?命令提示符?
标签: c# visual-studio-2015 asp.net-core-mvc entity-framework-core