public override HttpActionDescriptor SelectAction(HttpControllerContext controllerContext)
        {
            HttpActionDescriptor actionDescriptor = base.SelectAction(controllerContext);

            ReflectedHttpActionDescriptor reflectedActionDescriptor = actionDescriptor as ReflectedHttpActionDescriptor;

            if (null == reflectedActionDescriptor)
            {
                return(actionDescriptor);
            }

            CacheAttribute cacheAttribute = reflectedActionDescriptor.GetCustomAttributes <CacheAttribute>().FirstOrDefault()
                                            ?? reflectedActionDescriptor.ControllerDescriptor.GetCustomAttributes <CacheAttribute>().FirstOrDefault();

            if (null == cacheAttribute)
            {
                return(actionDescriptor);
            }
            return(new CacheableActionDescriptor(reflectedActionDescriptor, cacheAttribute));
        }
 public CacheableActionDescriptor(ReflectedHttpActionDescriptor actionDescriptor, CacheAttribute cacheAttribute)
     : base(actionDescriptor.ControllerDescriptor, actionDescriptor.MethodInfo)
 {
     this.CacheAttribute = cacheAttribute;
 }
 public CacheableActionDescriptor(ReflectedHttpActionDescriptor actionDescriptor,CacheAttribute cacheAttribute)
     : base(actionDescriptor.ControllerDescriptor,actionDescriptor.MethodInfo)
 {
     this.CacheAttribute = cacheAttribute;
 }