Example #1
0
        /// <summary>
        /// 注册远程代理对象
        /// </summary>
        public static void RegisterObject(RemotingServer remotingserver)
        {
            List <string> alltypepaths = RemoteObjectManager.GetAllRegisterTypes();//获取所有要注册的类前缀路径

            foreach (string beforekey in alltypepaths)
            {
                string regist = RemoteObjectManager.GetRemoteServerValue(beforekey + "/Register");
                if (!string.IsNullOrEmpty(regist) && regist.ToLower(CultureInfo.CurrentCulture).Trim() == "false")
                {
                    continue;
                }
                string dllpath   = RemoteObjectManager.GetRemoteServerValue(beforekey + "/" + "Path/value");
                string classname = RemoteObjectManager.GetRemoteServerValue(beforekey + "/" + "ClassName/value");
                string uriname   = RemoteObjectManager.GetRemoteServerValue(beforekey + "/" + "UriName/value");
                string wellmode  = RemoteObjectManager.GetRemoteServerValue(beforekey + "/" + "WellKnownObjectMode/value");
                string isstatic  = RemoteObjectManager.GetRemoteServerValue(beforekey + "/isStatic");

                string typeinfo = "";
                dllpath = IO.PathMg.CheckPath(dllpath);

                if (!string.IsNullOrEmpty(isstatic) && isstatic.ToLower(CultureInfo.CurrentCulture).Trim() == "true")
                {
                    string property = RemoteObjectManager.GetRemoteServerValue(beforekey + "/" + "Property/value");
                    typeinfo = remotingserver.RegisteRemoteStaticObject(dllpath, classname, property, uriname);//设置代理类
                }
                else
                {
                    typeinfo = remotingserver.RegisteRemoteObject(dllpath, classname, uriname, wellmode);//设置代理类
                }

                //Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("------------------------------");
            }
        }
Example #2
0
        /// <summary>
        /// 获取本地属性
        /// </summary>
        /// <param name="ObjectName"></param>
        /// <returns></returns>
        public static object CreateLocalPorperty(string ObjectName)
        {
            string dllpath   = GetObjectConfig("LocalConfig/LocalObject/" + ObjectName + "/Path/value");      //对象路径
            string classname = GetObjectConfig("LocalConfig/LocalObject/" + ObjectName + "/ClassName/value"); //对象类名
            string isstatic  = RemoteObjectManager.GetRemoteServerValue("LocalConfig/LocalObject/" + ObjectName + "/isStatic");
            string property  = RemoteObjectManager.GetRemoteServerValue("LocalConfig/LocalObject/" + ObjectName + "/Property/value");

            return(Reflection.ClassHelper.GetPropertyValue(Reflection.ClassHelper.GetClassObject(dllpath, classname), property,
                                                           !string.IsNullOrEmpty(isstatic) && isstatic.ToLower(CultureInfo.CurrentCulture).Trim() == "true"));
        }