Beispiel #1
0
        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));
        }
Beispiel #2
0
        public static string Precompile <T>(string text)
        {
            var ast = CSTemplateParser.Parse(text);

            return(CSCodeGenerator.Generate(ast, typeof(T), withNamespaces: false));
        }