Exemple #1
0
        public static MethodInfo CreateMethodInfo(string controllername, string methodname)
        {
            string[] names = controllername.Split(new char[] { '@' });
            if (names.Length != 2)
            {
                throw new Exception("控制器名称错误!");
            }
            string pluginname = names[0];
            string cname      = names[1];

            ModulePlugin mp;
            WinformControllerAttributeInfo cattr = AppPluginManage.GetPluginWinformControllerAttributeInfo(pluginname, cname, out mp);

            WinformMethodAttributeInfo mattr = cattr.MethodList.Find(x => x.methodName == methodname);

            if (mattr == null)
            {
                throw new Exception("控制器中没有此方法名");
            }

            if (mattr.dbkeys != null && mattr.dbkeys.Count > 0)
            {
                cattr.winformController.BindMoreDb(mp.database, "default");
                foreach (string dbkey in mattr.dbkeys)
                {
                    EFWCoreLib.CoreFrame.DbProvider.AbstractDatabase _Rdb = EFWCoreLib.CoreFrame.DbProvider.FactoryDatabase.GetDatabase(dbkey);
                    _Rdb.WorkId = cattr.winformController.LoginUserInfo.WorkId;
                    //创建数据库连接
                    cattr.winformController.BindMoreDb(_Rdb, dbkey);
                }
            }

            return(mattr.methodInfo);
        }
Exemple #2
0
        public static MethodInfo CreateMethodInfo(string controllername, string methodname)
        {
            try
            {
                WinformControllerAttributeInfo cattr = WinformControllerManager.GetControllerAttributeInfo(controllername);

                WinformMethodAttributeInfo mattr = cattr.MethodList.Find(x => x.methodName == methodname);
                if (mattr == null)
                {
                    throw new Exception("控制器中没有此方法名");
                }

                return(mattr.methodInfo);
            }
            catch (Exception err)
            {
                throw new Exception(err.Message);
            }
        }