TrackableEntities / EntityFrameworkCore.Scaffolding.Handlebars

Scaffold EF Core models using Handlebars templates.
MIT License
208 stars 53 forks source link

[BUG] #120

Closed kudorgyozo closed 4 years ago

kudorgyozo commented 4 years ago

Describe the bug TemplateData dictionary doesn't work

Expected behavior Templatedata variables should work

To Reproduce add this options.TemplateData = new Dictionary<string, object> { { "models-namespace", "SomeProject.Entities" }, { "context-namespace", "SomeProject.DataAccess" } };

use it in any of the templates:

{{#each dbsets}} {{spaces 8}}public virtual DbSet<{{models-namespace}}.{{set-property-type}}> {{set-property-name}} { get; set; }{{#if nullable-reference-types }} = default!;{{/if}} {{/each}}

results:

public virtual DbSet<.SomeEntity> SomeEntity { get; set; }

kudorgyozo commented 4 years ago

Nevermind, I had to use {{@root.models-namespace}}