Closed rumesh-smec closed 5 years ago
I need more information on what you are trying to do.
Thanks for your reply. I was tring to generate classes for my database at first place without any customizations, just following the steps metnioned here https://blog.tonysneed.com/2018/05/27/customize-ef-core-scaffolding-with-handlebars-templates/
The only diffrence is my database is hosted in Azure.
I will need to dig in to futher to give you more information. Will share any information if I able to troubleshoot in to further.
Do you think as per above error am I missing anything?
Can you generate entities without adding Handlebars?
Yes of course.
So you do not have a ScaffoldingDesignTimeServices
in your project? If this class is present (with the call to AddHandlebarsScaffolding
), then Handlebars templates will be used.
Can you paste here the dotnet ef
command you are using?
Please refer below. I removed the full connection string. Other paramters are same. I have 10+ tables, but I need only one table to generate, so I am passing the -t parameter. This same cammned works when I removed the ScaffoldingDesignTimeServices class from the project.
dotnet ef dbcontext scaffold "connection-string" Microsoft.EntityFrameworkCore.SqlServer -o Models -c MyDbContext -t Status
System.NotImplementedException: The method or operation is not implemented. at Microsoft.EntityFrameworkCore.Scaffolding.ProviderCodeGenerator.GenerateUseProvider(String connectionString) at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpDbContextGenerator.GenerateOnConfiguring(String connectionString, Boolean suppressConnectionStringWarning) at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpDbContextGenerator.GenerateClass(IModel model, String contextName, String connectionString, Boolean useDataAnnotations, Boolean suppressConnectionStringWarning) at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpDbContextGenerator.WriteCode(IModel model, String namespace, String contextName, String connectionString, Boolean useDataAnnotations, Boolean suppressConnectionStringWarning) at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpModelGenerator.GenerateModel(IModel model, String namespace, String contextDir, String contextName, String connectionString, ModelCodeGenerationOptions options) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, IEnumerable
1 tables, IEnumerable
1 schemas, String namespace, String language, String contextDir, String contextName, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions) at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable1 schemas, 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, IEnumerable1 schemaFilters, IEnumerable
1 tableFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>cDisplayClass0_1.<.ctor>b0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>cDisplayClass3_0`1.b 0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) The method or operation is not implemented.
FYI - We used the same with PowerTools and it works well. Thanks for your time on helping this out.
What version of the EF Core NuGet packages are you referencing?
Do the Power Tools work when you check "Use Handlebars"?
I’m having difficulty understanding and reproducing your issue. If you still require assistance, would you please create a small sample and publish it to GitHub so I can clone and see the errors firsthand?
Closing this issue, as I'm unable to reproduce.
I am tring to implment this for .net core 2.2 project. But getting System.NotImplementedException. Any idea?
System.NotImplementedException: The method or operation is not implemented. at Microsoft.EntityFrameworkCore.Scaffolding.ProviderCodeGenerator.GenerateUseProvider(String connectionString) at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpDbContextGenerator.GenerateOnConfiguring(String connectionString, Boolean suppressConnectionStringWarning) at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpDbContextGenerator.GenerateClass(IModel model, String contextName, String connectionString, Boolean useDataAnnotations, Boolean suppressConnectionStringWarning) at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpDbContextGenerator.WriteCode(IModel model, String namespace, String contextName, String connectionString, Boolean useDataAnnotations, Boolean suppressConnectionStringWarning) at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpModelGenerator.GenerateModel(IModel model, String namespace, String contextDir, String contextName, String connectionString, ModelCodeGenerationOptions options) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, IEnumerableb 0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
The method or operation is not implemented.
1 tables, IEnumerable
1 schemas, String namespace, String language, String contextDir, String contextName, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions) at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable1 schemas, 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, IEnumerable1 schemaFilters, IEnumerable
1 tableFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>cDisplayClass0_1.<.ctor>b0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>cDisplayClass3_0`1.