Example #1
0
        // Methods
        public static IHtmlString Get(String key, Func <String> sourceFactory, Boolean debugMode)
        {
            if (debugMode)
            {
                return(new HtmlString(CompileHelper.CompileTemplate(sourceFactory)));
            }

            return(new HtmlString(_cache.GetOrAdd(key, sourceFactory)));
        }
Example #2
0
        public static IHtmlString Get(Expression <Func <HelperResult> > sourceFactory, Boolean debugMode)
        {
            if (debugMode)
            {
                return(new HtmlString(CompileHelper.CompileTemplate(sourceFactory)));
            }

            return(new HtmlString(_cache.GetOrAdd(sourceFactory)));
        }
Example #3
0
        // Methods
        public String GetOrAdd(String key, Func <String> sourceFactory)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (sourceFactory == null)
            {
                throw new ArgumentNullException("sourceFactory");
            }

            return(_cache.GetOrAdd(key, (x) => CompileHelper.CompileTemplate(sourceFactory)));                  // x is the key
        }