public SessionStateBehavior GetControllerSessionBehavior(RequestContext requestContext, string controllerName) { Type controllerType = GetControllerType(requestContext, controllerName); if (controllerType != null) { ConcurrentDictionary <Type, SessionStateBehavior> types = ContainerControllerFactory._sessionStateCache; return(types.GetOrAdd(controllerType, (Type type) => { bool flag = true; SessionStateAttribute sessionStateAttribute = type.GetCustomAttributes(typeof(SessionStateAttribute), flag).OfType <SessionStateAttribute>().FirstOrDefault <SessionStateAttribute>(); if (sessionStateAttribute != null) { return sessionStateAttribute.Behavior; } else { return SessionStateBehavior.Default; } } )); } else { return(SessionStateBehavior.Default); } }
public SessionStateBehavior GetControllerSessionBehavior(RequestContext requestContext, string controllerName) { Type controllerType = this.GetControllerType(requestContext.RouteData, controllerName); if (null == controllerType) { return(SessionStateBehavior.Default); } else { if (SessionStateBehaviorCache.ContainsKey(controllerType)) { return(SessionStateBehaviorCache[controllerType]); } else { SessionStateAttribute attribute = controllerType.GetCustomAttributes(true).OfType <SessionStateAttribute>() .FirstOrDefault(); attribute = attribute ?? new SessionStateAttribute(SessionStateBehavior.Default); lock (this) { if (!SessionStateBehaviorCache.ContainsKey(controllerType)) { SessionStateBehaviorCache.Add(controllerType, attribute.Behavior); } } return(attribute.Behavior); } } }
public SessionStateBehavior GetControllerSessionBehavior(RequestContext requestContext, string controllerName) { Type controllerType = this.GetControllerType(requestContext.RouteData, controllerName); if (null == controllerType) { return(SessionStateBehavior.Default); } SessionStateAttribute attribute = controllerType.GetCustomAttributes(true).OfType <SessionStateAttribute>().FirstOrDefault(); attribute = attribute ?? new SessionStateAttribute(SessionStateBehavior.Default); return(attribute.Behavior); }