private CompilationData GenerateCode(string path)
        {
            var viewDefinition = _viewProvider.GetViewDefinition(path);
            var host           = OpenRastaRazorHostFactory.CreateHost(DetermineCodeLanguage(viewDefinition.FileName));
            var engine         = new RazorTemplateEngine(host);
            GeneratorResults results;

            using (TextReader reader = viewDefinition.Contents)
            {
                results = engine.GenerateCode(reader, GetClassName(viewDefinition.FileName), host.DefaultNamespace, viewDefinition.FileName);
            }
            if (!results.Success)
            {
                throw CreateExceptionFromParserError(results.ParserErrors.Last(), path);
            }
            return(new CompilationData(GetReferencedAssemblies(viewDefinition), results.GeneratedCode));
        }
 private OpenRastaRazorHost CreateHost()
 {
     return(OpenRastaRazorHostFactory.CreateHost(GetCodeLanguage()));
 }