Esempio n. 1
0
        public static Func <IApiController, Object[], Object> GetMethodFunc(MethodInfo methodInfo)
        {
            Type        reference = methodInfo.ReflectedType;
            ActionCache cache     = s_actionCache[reference];

            if (cache == null)
            {
                throw new Exception("没有此路由对应的方法");
            }
            return(cache.GetMethodFunc(methodInfo));
        }
Esempio n. 2
0
        public static MethodInfo GetMethodInfo(Type controller, String actionname)
        {
            if (!s_actionCache.ContainsKey(controller))
            {
                throw new Exception("没有此路由对应的类型");
            }
            ActionCache cache = s_actionCache[controller];

            if (!cache.ContainsKey(actionname))
            {
                throw new Exception("没有此路由对应的方法");
            }
            return(cache[actionname]);
        }
Esempio n. 3
0
        /// <summary>
        /// 通过路由值获取对应的委托方法
        /// </summary>
        /// <param name="controllername"></param>
        /// <param name="actionname"></param>
        /// <returns></returns>
        public static Func <IApiController, Object[], Object> GetMethodFunc(Type controller, String actionname)
        {
            if (!s_actionCache.ContainsKey(controller))
            {
                throw new Exception("没有此路由对应的类型");
            }
            ActionCache cache = s_actionCache[controller];

            if (!cache.ContainsKey(actionname))
            {
                throw new Exception("没有此路由对应的方法");
            }
            return(cache.GetMethodFunc(actionname));
        }