How To Compile Razor Template
&" }); Console.WriteLine(result); // Output: <html>& /* Without encoding */ cord template = "Render @Raw(Model.Tag)"; string issue = await engine.CompileRenderAsync("templateKey", template, new { Tag = "&" }); Console.WriteLine(outcome); // Output: &">
/* With encoding (default) */ string template = "Render @Model.Tag" ; string result = expect engine.CompileRenderAsync( "templateKey" , template, new { Tag = "<html>&" }); Console.WriteLine(result); // Output: <html>& /* Without encoding */ string template = "Render @Raw(Model.Tag)" ; string consequence = await engine.CompileRenderAsync( "templateKey" , template, new { Tag = "<html>&" }); Panel.WriteLine(effect); // Output: <html>&
In order to disable encoding for the unabridged document - only set "DisableEncoding" variable to true
@model TestViewModel @{ DisableEncoding = true; } < html > Hello @Model.Tag </ html > Enable Intellisense support
Visual Studio tooling knows zippo nigh RazorLight and assumes, that the view you are using - is a typical ASP.Net MVC template. In gild to enable Intellisense for RazorLight templates, you should give Visual Studio a little hint about the base template class, that all your templates inherit implicitly

0 Response to "How To Compile Razor Template"
Post a Comment