public void RenderView(StubViewContext viewContext) { var descriptor = new SparkViewDescriptor(); descriptor.Templates.Add(viewContext.ControllerName + "\\" + viewContext.ViewName + ".spark"); if (viewContext.MasterName != null) descriptor.Templates.Add("Shared\\" + viewContext.MasterName + ".spark"); var sparkView = Engine.CreateInstance(descriptor); ((StubSparkView)sparkView).ViewData = viewContext.Data; sparkView.RenderView(new StringWriter(viewContext.Output)); }
public void RenderView(StubViewContext viewContext, string extension = null) { var descriptor = new SparkViewDescriptor(); descriptor.Templates.Add(Path.Combine(viewContext.ControllerName, viewContext.ViewName + (extension ?? Constants.DotSpark))); if (viewContext.MasterName != null) descriptor.Templates.Add(Path.Combine(Constants.Shared, viewContext.MasterName + (extension ?? Constants.DotSpark))); var sparkView = Engine.CreateInstance(descriptor); ((StubSparkView)sparkView).ViewData = viewContext.Data; ((StubSparkView)sparkView).CacheService = CacheService; sparkView.RenderView(new StringWriter(viewContext.Output)); }
public void RenderView(StubViewContext viewContext) { var descriptor = new SparkViewDescriptor(); descriptor.Templates.Add(viewContext.ControllerName + "\\" + viewContext.ViewName + ".spark"); if (viewContext.MasterName != null) { descriptor.Templates.Add("Shared\\" + viewContext.MasterName + ".spark"); } var sparkView = Engine.CreateInstance(descriptor); ((StubSparkView)sparkView).ViewData = viewContext.Data; ((StubSparkView)sparkView).CacheService = CacheService; sparkView.RenderView(new StringWriter(viewContext.Output)); }
public void RenderView(StubViewContext viewContext, string extension = null) { var descriptor = new SparkViewDescriptor(); descriptor.Templates.Add(Path.Combine(viewContext.ControllerName, viewContext.ViewName + (extension ?? Constants.DotSpark))); if (viewContext.MasterName != null) { descriptor.Templates.Add(Path.Combine(Constants.Shared, viewContext.MasterName + (extension ?? Constants.DotSpark))); } var sparkView = Engine.CreateInstance(descriptor); ((StubSparkView)sparkView).ViewData = viewContext.Data; ((StubSparkView)sparkView).CacheService = CacheService; sparkView.RenderView(new StringWriter(viewContext.Output)); }
private string Render(string viewName, StubViewData viewData) { var context = new StubViewContext { ControllerName = "home", ViewName = viewName, Output = new StringBuilder(), Data = viewData }; _factory.RenderView(context); return context.Output.ToString() .Replace("\r\n\r\n", "\r\n") .Replace("\r\n\r\n", "\r\n"); }