Beispiel #1
0
        public static Template CreateTemplate(string templateFile, string destinationPath, bool onlyBody)
        {
            if (WebAppContext.Offline)
                return new Template(templateFile,destinationPath, onlyBody);

            string key = "TPL: " + destinationPath + ";" + templateFile;

            Template template = (Template) WebAppContext.WebCache[key];

            if (template != null)
                return template;

            lock (_templateCacheLock)
            {
                template = (Template) WebAppContext.WebCache[key];

                if (template != null)
                    return template;

                template = new Template(templateFile, destinationPath, onlyBody);

                WebAppContext.WebCache.Insert(key, template, new CacheDependency(templateFile), Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(30));
            }

            return template;
        }
Beispiel #2
0
 public static Template CreateTemplate(Template callingTemplate, string templateName, bool onlyBody)
 {
     return CreateTemplate(templateName, callingTemplate._destinationPath, onlyBody);
 }