Is is possible to use a master layout when using Spark in the form of the Direct Usage Sample? I have tried using both in my layout with my master layout in the same folder as the calling layout and I have also tried adding the master layout as a template to the SparkViewDescriptor in the code below?
public class DefaultMessageBuilder : MessageBuilder
{
private readonly ISparkViewEngine _engine;
public DefaultMessageBuilder()
{
var settings = new SparkSettings()
.SetDebug(true)
.SetPageBaseType(typeof(TemplateBase))
.AddNamespace("System.Collections.Generic");
var templates = new VirtualPathProviderViewFolder("~/Templates");
_engine = new SparkViewEngine(settings) { ViewFolder = templates };
}
public override void Transform(string templateName, object data, TextWriter output)
{
var descriptor = new SparkViewDescriptor()
.AddTemplate("Master.spark")
.AddTemplate(templateName + ".spark");
var view = (TemplateBase)_engine.CreateInstance(descriptor);
try
{
view.ViewData = new ViewDataDictionary(data);
view.RenderView(output);
}
finally
{
_engine.ReleaseInstance(view);
}
}
}