I'm using the following snippet to enable Razor templating in my solution (outside of ASP.NET MVC3). Is it possible to easily implement layouts?
Background info:
I'm at this point (templates are compiled into compiledTemplateAssembly
):
var template = (RazorTemplateBase<TModel>) compiledTemplateAssembly.
CreateInstance("RazorSpace." + entry.TemplateName + "Template");
template.Model = model;
template.Execute();
var output = template.Buffer.ToString();
template.Buffer.Clear();
return output;
I can imagine having a Layout
property on my RazorTemplateBase
class. But then? I understand that Html.Partial
is a helper function which I can just implement to parse a template. But how do I parse those method calls renderBody()
or renderSection()
to accept other Razor views?