private string GetEntityTemplateVirtualPathWithCaching(MetaTable table, DataBoundControlMode mode, string uiHint) { long cacheKey = Misc.CombineHashCodes(table, mode, uiHint); return(_factory.GetTemplatePath(cacheKey, delegate() { return GetEntityTemplateVirtualPath(table, mode, uiHint); })); }
// internal for unit testing internal string GetFilterVirtualPathWithCaching(MetaColumn column, string filterUIHint) { Debug.Assert(column != null); long cacheKey = Misc.CombineHashCodes(column, filterUIHint); return(_templateFactory.GetTemplatePath(cacheKey, delegate() { return GetFilterVirtualPath(column, filterUIHint); })); }
// Internal for unit test purpose internal string GetFieldTemplateVirtualPathWithCaching(MetaColumn column, DataBoundControlMode mode, string uiHint) { // Compute a cache key based on all the input paramaters long cacheKey = Misc.CombineHashCodes(uiHint, column, mode); Func <string> templatePathFactoryFunction = () => GetFieldTemplateVirtualPath(column, mode, uiHint); return(_templateFactory.GetTemplatePath(cacheKey, templatePathFactoryFunction)); }
private string GetPageVirtualPath(DynamicDataRoute route, MetaTable table, string action) { long cacheKey = Misc.CombineHashCodes(table, route.ViewName ?? action); Dictionary <long, string> virtualPathCache = GetVirtualPathCache(); string virtualPath; if (!virtualPathCache.TryGetValue(cacheKey, out virtualPath)) { virtualPath = GetPageVirtualPathNoCache(route, table, action); lock (virtualPathCache) { virtualPathCache[cacheKey] = virtualPath; } } return(virtualPath); }