You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is there, though the usage is a little bit different: you have to specify template base type + model type instead of model type only. It is much cooler because you are free to add any extra helpers to template (see #6 (comment))
stringcontent="Hello @Model.Name";// yeah, heavy definitionRazorEngineCompiledTemplate<RazorEngineTemplateBase<TestModel>>template=razorEngine.Compile<RazorEngineTemplateBase<TestModel>>(content);stringresult=template.Run(instance =>{instance.Model=newTestModel(){Name="Hello",Items=new[]{3,1,2}};});Console.WriteLine(result);
Make sure to update to Install-Package RazorEngineCore -Version 2020.3.3
Would it be possible to have a template base, as with various other Razor engines, to allow the model passed in to be statically typed?
i.e.
https://github.com/toddams/RazorLight#enable-intellisense-support
https://antaris.github.io/RazorEngine/IntellisenseAndResharper.html
The text was updated successfully, but these errors were encountered: