Closed kudorgyozo closed 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; }
Nevermind, I had to use {{@root.models-namespace}}
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; }