コード例 #1
0
ファイル: SandBoxChannel.cs プロジェクト: xiaogemm/Huber.net
        /// <summary>获取所有的action
        /// </summary>
        /// <returns></returns>
        public Dictionary <string, CAModel> GetAllAction()
        {
            Dictionary <string, CAModel> result = null;

            Type[]       types      = _assembly.GetTypes();
            MethodInfo[] meths      = null;
            string       controller = string.Empty;

            if (types != null)
            {
                result = new Dictionary <string, CAModel>();
                string  url = string.Empty;
                CAModel temp;
                foreach (var t in types)
                {
                    if (t.BaseType != null && t.BaseType.ToString() == "Huber.Kernel.MVC.HuberController")
                    {
                        meths = t.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
                        foreach (var m in meths)
                        {
                            temp = new CAModel(t.ToString(), m.Name);
                            result.Add(temp.UrlPath.ToLower(), temp);
                        }
                    }
                }
            }

            return(result);
        }
コード例 #2
0
ファイル: SandBoxChannel.cs プロジェクト: PerryPal/Huber.net
        /// <summary>获取所有的action
        /// </summary>
        /// <returns></returns>
        public Dictionary<string, CAModel> GetAllAction()
        {
            Dictionary<string, CAModel> result = null;
            Type[] types = _assembly.GetTypes();
            MethodInfo[] meths = null;
            string controller = string.Empty;
            if (types != null)
            {
                result = new Dictionary<string, CAModel>();
                string url = string.Empty;
                CAModel temp;
                foreach (var t in types)
                {
                    if (t.BaseType != null && t.BaseType.ToString() == "Huber.Kernel.MVC.HuberController")
                    {

                        meths = t.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
                        foreach (var m in meths)
                        {
                            temp = new CAModel(t.ToString(), m.Name);
                            result.Add(temp.UrlPath.ToLower(), temp);
                        }
                    }
                }
            }

            return result;
        }