private static Compilation Compile <T>(string template) { var ast = CSTemplateParser.Parse(template); var code = CSCodeGenerator.Generate(ast, typeof(T), withNamespaces: true); var tree = CSharpSyntaxTree.ParseText(code); return(CSharpCompilation.Create("TemplateAssembly", new[] { tree }, _CSRefs, _CSOpts)); }
public static string Precompile <T>(string text) { var ast = CSTemplateParser.Parse(text); return(CSCodeGenerator.Generate(ast, typeof(T), withNamespaces: false)); }