// 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))); }
public static IHtmlString Get(Expression <Func <HelperResult> > sourceFactory, Boolean debugMode) { if (debugMode) { return(new HtmlString(CompileHelper.CompileTemplate(sourceFactory))); } return(new HtmlString(_cache.GetOrAdd(sourceFactory))); }
// 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 }