protected static void RenderView <T>(String viewPath, T model) { ViewEngineElement conf = MiniMvcSystem.Config.ViewEngine; var ctx = HttpContext.Current; String source = File.ReadAllText(Path.Combine(ctx.Server.MapPath(conf.ViewsFolder), viewPath) + conf.ViewExtension); var ts = GetTemplateService(conf); var result = ts.Parse(source, model); HttpContext.Current.Response.Write(result); }
private static ITemplateService GetTemplateService(ViewEngineElement conf) { var ts = new TemplateService(); foreach (NamespaceElement ns in conf.Namespaces) { ts.AddNamespace(ns.Namespace); } return(ts); }