banner



How To Compile Razor Template

&" }); Console.WriteLine(result); // Output: <html>&amp /* 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: &lt;html&gt;&amp                              /*                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

Related Posts

", numPosts: 8, titleLength: "auto", thumbnailWidth: 159, thumbnailHeight: 89, noImage: "//1.bp.blogspot.com/-aR5w9KXuWGU/XhSDNRAVuhI/AAAAAAAAHG8/dLxcaZxSgh0v85JG0mWRMQyEwqMgpL1_gCLcBGAsYHQ/w159-h89-c/no-image.jpg", containerId: "related-post-6628337512218704625", newTabLink: false, moreText: "Read More", widgetStyle: 3, callBack: function() {} };

0 Response to "How To Compile Razor Template"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel