Esempio n. 1
0
        public virtual string Execute(Dictionary <string, object> properties, string templateFile)
        {
            lock (syncRoot)
            {
                this.host = new TemplateHost(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), MapProperties(properties));
                this.host.TemplateFile = templateFile;

                ITextTemplatingEngine engine = new Engine();
                string template = File.ReadAllText(this.host.TemplateFile);
                string result   = engine.ProcessTemplate(template, this.host);

                return(result);
            }
        }
        public override void Initialize(ITextTemplatingEngineHost host)
        {
            base.Initialize(host);

            this.templateHost = (TemplateHost)host;
        }