Scaffold-DbContext“未实现方法或操作”

时间:2018-12-20 23:12:02

标签: entity-framework .net-core ef-code-first ef-core-2.0 ef-core-2.1

玩得不开心。

PM>命令运行

Scaffold-DbContext "Server=myserver;Database=mysqlserverdb;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -Tables Settings -verbose

错误:

  

该方法或操作未实现。

System.NotImplementedException: The method or operation is not implemented. at Microsoft.EntityFrameworkCore.Scaffolding.ProviderCodeGenerator.GenerateUseProvider(String connectionString) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpDbContextGenerator.GenerateOnConfiguring(String connectionString, Boolean suppressConnectionStringWarning) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpDbContextGenerator.GenerateClass(IModel model, String contextName, String connectionString, Boolean useDataAnnotations, Boolean suppressConnectionStringWarning) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpDbContextGenerator.WriteCode(IModel model, String namespace, String contextName, String connectionString, Boolean useDataAnnotations, Boolean suppressConnectionStringWarning) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpModelGenerator.GenerateModel(IModel model, String namespace, String contextDir, String contextName, String connectionString, ModelCodeGenerationOptions options) at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable 1个架构,IEnumerable 1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable 1个SchemaFilters,IEnumerable 1 tableFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_1.<.ctor>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0 1.b__0()    在Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)`

1 个答案:

答案 0 :(得分:0)

在安装 EF电动工具最新Core 2.2.xx SDK 之间,现在我可以更改项目以使用下拉更改到.net core 2.2(以前只能执行2.1。

然后使用Nuget更新等。,它终于可以工作了!