Closed newsoftinc closed 5 years ago
Hello, I can also confirm that the debugger steps in the ScaffoldingDesignTimeServices by attaching the debugger to dotnet executable. Could you give us a hint ? I need handlebars for my migration from ef6 to core. I can debug the issue. It seems like the helper is not detected / invoked, because debugger never step in the helper function. Where does the helpers get resolved, when the handlebar parser see finds a custom tag?
Ok so your wrapping method, services.AddHandlebarsHelpers(myHelper) , over HandlebarsDotNet.Handlebars.RegisterHelper , does not register the templates in handlebar.
Adding nuget ref to handlebar, and directly add the template, fix the issue. HandlebarsDotNet.Handlebars.RegisterHelper("my-helper", MyHbsHelper);
Why do you make additionnal plumbing over the native call? Only plus I see is to avoid adding references to handlerbar in target projects.
Anyways, i'm not sure where to fix this, but now you know the problem.
This appears to be a duplicate of #31, which as been fixed by #42. @newsoftinc Please re-open this issue if this is not the case.
@newsoftinc This has been fixed in v1.7.0.
Running the latest nuget on a new .net core projet.
Running SDK : PM> dotnet --version 2.1.403
Services class :
`using System; using System.IO; using Microsoft.EntityFrameworkCore.Design; using Microsoft.Extensions.DependencyInjection;
namespace EFCoreScaffold { public class ScaffoldingDesignTimeServices : IDesignTimeServices { public void ConfigureDesignTimeServices(IServiceCollection services) { // Generate both context and entitites var options = ReverseEngineerOptions.DbContextAndEntities;
} ` Class.hbs (Generated by first run of dotnet ef dbcontext scaffold
`{{> imports}} {{my-helper}} namespace {{namespace}} { {{#if class-annotation}} {{{class-annotation}}} {{/if}}
//This is a test ! public partial class {{class}} {{my-helper}} { {{{> constructor}}} {{> properties}} } } ` The comment //This is a test ! , appears, but the helper is not called.