private Type getViewType(RazorTemplate descriptor) { var className = ParserHelpers.SanitizeClassName(descriptor.ViewPath); var baseTemplateType = _razorEngineSettings.BaseTemplateType; var generatedClassContext = new GeneratedClassContext("Execute", "Write", "WriteLiteral", "WriteTo", "WriteLiteralTo", "FubuMVC.Razor.Rendering.TemplateHelper", "DefineSection"); var codeLanguage = RazorCodeLanguageFactory.Create(descriptor.FilePath.FileExtension()); var host = new RazorEngineHost(codeLanguage) { DefaultBaseClass = baseTemplateType.FullName, DefaultNamespace = "FubuMVC.Razor.GeneratedTemplates", GeneratedClassContext = generatedClassContext }; host.NamespaceImports.UnionWith(_commonViewNamespaces.Namespaces); var results = _templateGenerator.GenerateCode(descriptor, className, host); return(_templateCompiler.Compile(className, results.GeneratedCode, host)); }