问题描述
玩得不开心。
PM>命令运行
Scaffold-DbContext "Server=myserver;Database=mysqlserverdb;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -Tables Settings -verbose
错误:
System.NotImplementedException:未实现该方法或操作。 $。 Scaffolding.Internal.CSharpDbContextGenerator.GenerateClass(IModel模型,字符串contextName,字符串connectionString,布尔useDataAnnotations,布尔hibitConnectionStringWarning)
1模式,IEnumerable
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpDbContextGenerator.WriteCode(IModel模型,字符串名称空间,字符串contextName,字符串connectionString,布尔值useDataAnnotations,布尔值detectConnectionStringWarning)Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpModelGenerator.GenerateModel(IModel模型,字符串命名空间,字符串contextDir,字符串contextName,字符串connectionString,ModelCodeGenerationOptions选项)
在Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(字符串提供程序,字符串connectionString,字符串outputDir,字符串outputContextDir,字符串dbContextClassName,IEnumerable 1表,布尔值useDataAnnotations,布尔值overwriteFiles,布尔值useDatabaseNames)Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider,String connectionString,String outputDir,String outputDbContextDir,String dbContextClassName,IEnumerable
1 schemaFilters,IEnumer 1个表过滤器,布尔useDataAnnotations,布尔overwriteFiles,布尔useDatabaseNames)
1.b__0()
在Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext。<> c__DisplayClass0_1。< .ctor&b; b__0()
<> c__DisplayClass3_0
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.Ope rationBase.Execute(Action action)`
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 schemas, IEnumerable1 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, IEnumerable1 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() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)`
推荐答案
在安装 EF电动工具和之间>最新的Core 2.2.xx SDK ,我现在可以更改项目,以使用对.net core 2.2的下拉更改(以前只能执行2.1。
Between installing the EF power Tools and the Latest Core 2.2.x.x SDK I am now able to change my project to use dropdown change to the .net core 2.2 (it was previously only able to do 2.1.
然后使用Nuget更新等。,它终于可以工作了!
Then with Nuget updates etc.. , it finally works!
这篇关于支架-DbContext“未实现该方法或操作”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!