예제 #1
0
        public void AddTemplate(string name, string template)
        {
            try
            {
                name = name.ToLower();
                lock (mTemplates)
                {
                    ITemplateInfo info = null;
                    mTemplates.TryGetValue(name, out info);
                    if (info == null)
                    {
                        info = new StringTemplateInfo(name, template);
                        mTemplates[name] = info;
                    }
                    ((Implement.StringTemplateInfo)info).TemplateData = template;
                    info.Host = this;
                    info.Clean();

                }
            }
            catch (RazorException re)
            {
                throw re;
            }
            catch (Exception e_)
            {
                throw new RazorException("add  string template error " + e_.Message, e_);
            }
        }
예제 #2
0
 public void AddTemplate(string name, string template)
 {
     try
     {
         name = name.ToLower();
         lock (mTemplates)
         {
             ITemplateInfo info = null;
             mTemplates.TryGetValue(name, out info);
             if (info == null)
             {
                 info             = new StringTemplateInfo(name, template);
                 mTemplates[name] = info;
             }
             ((Implement.StringTemplateInfo)info).TemplateData = template;
             info.Host = this;
             info.Clean();
         }
     }
     catch (RazorException re)
     {
         throw re;
     }
     catch (Exception e_)
     {
         throw new RazorException("add  string template error " + e_.Message, e_);
     }
 }