public ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache) { string controllerName = controllerContext.RouteData.GetRequiredString("controller"); ViewEngineResultCacheKey key = new ViewEngineResultCacheKey(controllerName, viewName); ViewEngineResult result; if (!useCache) { result = InternalFindView(controllerContext, viewName, controllerName); viewEngineResults[key] = result; return(result); } if (viewEngineResults.TryGetValue(key, out result)) { return(result); } lock (syncHelper) { if (viewEngineResults.TryGetValue(key, out result)) { return(result); } result = InternalFindView(controllerContext, viewName, controllerName); viewEngineResults[key] = result; return(result); } }
public override bool Equals(object obj) { ViewEngineResultCacheKey key = obj as ViewEngineResultCacheKey; if (null == key) { return(false); } return(key.GetHashCode() == this.GetHashCode()); }