public VeilHandlebarsRenderSpeedBenchmarkCase()
        {
            var templateContents = Templates.ReadTemplate("Template.hbs");
            var context = new VeilContext();
            context.RegisterTemplate("Roles", Templates.ReadTemplate("Roles.hbs"));
            var engine = new VeilEngine(context);

            compiledTypedTemplate = engine.Compile<ViewModel>("hbs", new StringReader(templateContents));
            compiledUntypedTemplate = engine.CompileNonGeneric("hbs", new StringReader(templateContents), typeof(ViewModel));
            compiledDynamicTemplate = engine.Compile<dynamic>("hbs", new StringReader(templateContents));
            compiledDictionaryTemplate = engine.Compile<IDictionary<string, object>>("hbs", new StringReader(templateContents));
        }
Exemple #2
0
        public VeilHandlebarsRenderSpeedBenchmarkCase()
        {
            var templateContents = Templates.ReadTemplate("Template.haml");
            var context          = new VeilContext();

            context.RegisterTemplate("Roles", Templates.ReadTemplate("Roles.haml"));
            var engine = new VeilEngine(context);

            compiledTypedTemplate      = engine.Compile <ViewModel>("haml", new StringReader(templateContents));
            compiledUntypedTemplate    = engine.CompileNonGeneric("haml", new StringReader(templateContents), typeof(ViewModel));
            compiledDynamicTemplate    = engine.Compile <dynamic>("haml", new StringReader(templateContents));
            compiledDictionaryTemplate = engine.Compile <IDictionary <string, object> >("haml", new StringReader(templateContents));
        }
        public VeilGCBenchmarkCase()
        {
            var templateContents = Templates.ReadTemplate("Template.sshtml");
            var context = new VeilContext();
            context.RegisterTemplate("Master", Templates.ReadTemplate("Master.sshtml"));
            context.RegisterTemplate("Roles", Templates.ReadTemplate("Roles.sshtml"));
            var engine = new VeilEngine(context);

            template = engine.Compile<ViewModel>("sshtml", new StringReader(templateContents));
        }
Exemple #4
0
 private static string Generate(ContentModel model)
 {
     var engine = new VeilEngine();
     var template = engine.Compile<ContentModel>("handlebars", new StringReader(Resources.Template));
     using (var writer = new StringWriter())
     {
         template(writer, model);
         return RemoveEmptyLines(writer.ToString());
     }
 }
Exemple #5
0
        public VeilGCBenchmarkCase()
        {
            var templateContents = Templates.ReadTemplate("Template.sshtml");
            var context          = new VeilContext();

            context.RegisterTemplate("Master", Templates.ReadTemplate("Master.sshtml"));
            context.RegisterTemplate("Roles", Templates.ReadTemplate("Roles.sshtml"));
            var engine = new VeilEngine(context);

            template = engine.Compile <ViewModel>("sshtml", new StringReader(templateContents));
        }