Ejemplo n.º 1
0
        /// <summary>
        /// This method creates instance of Remote object.
        /// </summary>
        /// <param name="serverType"></param>
        /// <returns>Remote object of Remote service.</returns>
        public static object CreateInstance(Type serverType)
        {
            if (InstanceType.Local == Global.InstanceType)
            {
                return(Activator.CreateInstance(serverType));
            }
            else
            {
                string       url   = ConfigurationSettings.AppSettings["RemoteServer"];
                DiaSoftProxy proxy = new DiaSoftProxy(serverType, url + serverType.ToString() + ".rem");

                object mbrClient = proxy.GetTransparentProxy();
                //if (!_htMarshalObject.Contains(serverType))
                //    _htMarshalObject.Add(serverType, proxy.CreateObjRef(mbrClient.GetType()));
                //else
                //    _htMarshalObject[serverType] = proxy.CreateObjRef(serverType);

                return(mbrClient);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This method creates instance of Remote object.
        /// </summary>
        /// <param name="serverType"></param>
        /// <returns>Remote object of Remote service.</returns>
        public static object CreateInstance(Type serverType)
        {
            if (InstanceType.Local == Global.InstanceType)
                return Activator.CreateInstance(serverType);
            else
            {
                string url = ConfigurationSettings.AppSettings["RemoteServer"];
                DiaSoftProxy proxy = new DiaSoftProxy(serverType, url + serverType.ToString() + ".rem");

                object mbrClient = proxy.GetTransparentProxy();
                //if (!_htMarshalObject.Contains(serverType))
                //    _htMarshalObject.Add(serverType, proxy.CreateObjRef(mbrClient.GetType()));
                //else
                //    _htMarshalObject[serverType] = proxy.CreateObjRef(serverType);

                return mbrClient;
            }
        }