コード例 #1
0
ファイル: Template.cs プロジェクト: MartinF/Dynamo.Templates
        // 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)));
        }
コード例 #2
0
ファイル: Template.cs プロジェクト: MartinF/Dynamo.Templates
        public static IHtmlString Get(Expression <Func <HelperResult> > sourceFactory, Boolean debugMode)
        {
            if (debugMode)
            {
                return(new HtmlString(CompileHelper.CompileTemplate(sourceFactory)));
            }

            return(new HtmlString(_cache.GetOrAdd(sourceFactory)));
        }
コード例 #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
        }