RegisterTemplate() public method

public RegisterTemplate ( string name, string content ) : void
name string
content string
return void
示例#1
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));
        }
        public VeilSuperSimpleRenderSpeedBenchmarkCase()
        {
            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);

            compiledTypedTemplate = engine.Compile<ViewModel>("sshtml", new StringReader(templateContents));
            compiledUntypedTemplate = engine.CompileNonGeneric("sshtml", new StringReader(templateContents), typeof(ViewModel));
            compiledDynamicTemplate = engine.Compile<dynamic>("sshtml", new StringReader(templateContents));
            compiledDictionaryTemplate = engine.Compile<IDictionary<string, object>>("sshtml", new StringReader(templateContents));
        }