Entity framework core EntityFramework核心数据库脚手架(.NET Core RC2)
我尝试使用现有数据库(doc here:)创建EntityFramework核心的模型,但出现了一个错误 当我尝试使用包管理器方法时,出现以下错误:Entity framework core EntityFramework核心数据库脚手架(.NET Core RC2),entity-framework-core,asp.net-core-1.0,.net-core-rc2,Entity Framework Core,Asp.net Core 1.0,.net Core Rc2,我尝试使用现有数据库(doc here:)创建EntityFramework核心的模型,但出现了一个错误 当我尝试使用包管理器方法时,出现以下错误: The term "MY_DATABASE_NAME" is not recognize as a valid command applet [...] 这是我执行的命令: Scaffold-DbContext "'MY_CONNECTION_STRING'" Microsoft.EntityFrameworkCore.SqlServer -ou
The term "MY_DATABASE_NAME" is not recognize as a valid command applet [...]
这是我执行的命令:
Scaffold-DbContext "'MY_CONNECTION_STRING'" Microsoft.EntityFrameworkCore.SqlServer -outputDir MY_PATH -verbose
当我尝试命令提示符方法时,出现以下错误:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.EntityFrameworkCore.Tools.DispatchCommand.<>c__DisplayClass2_0.<Create>b__0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
Object reference not set to an instance of an object.
在回答这个问题之前,我检查了一下:
使用命令提示成功:
dotnet ef dbcontext scaffold "MY_CONNECTION_STRING" Microsoft.EntityFrameworkCore.SqlServer -o MY_ABSOLUTE_PATH
请不要在问题标题中添加“已解决”。表示问题已通过接受答案解决。原始错误可能已通过安装Powershell 5解决。
dotnet ef dbcontext scaffold "MY_CONNECTION_STRING" Microsoft.EntityFrameworkCore.SqlServer -o MY_ABSOLUTE_PATH