InitActivationServices() private static method

private static InitActivationServices ( ) : void
return void
Exemplo n.º 1
0
        private static MarshalByRefObject CreateObjectForCom(RuntimeType serverType, object[] props, bool bNewObj)
        {
            if (ActivationServices.PeekActivationAttributes((Type)serverType) != null)
            {
                throw new NotSupportedException(Environment.GetResourceString("NotSupported_ActivForCom"));
            }
            ActivationServices.InitActivationServices();
            ProxyAttribute proxyAttribute = ActivationServices.GetProxyAttribute((Type)serverType);

            return(!(proxyAttribute is ICustomFactory) ? (MarshalByRefObject)Activator.CreateInstance((Type)serverType, true) : ((ICustomFactory)proxyAttribute).CreateInstance((Type)serverType));
        }
Exemplo n.º 2
0
        private static MarshalByRefObject IsCurrentContextOK(RuntimeType serverType, object[] props, bool bNewObj)
        {
            ActivationServices.InitActivationServices();
            ProxyAttribute     proxyAttribute = ActivationServices.GetProxyAttribute((Type)serverType);
            MarshalByRefObject marshalByRefObject;

            if (proxyAttribute == ActivationServices.DefaultProxyAttribute)
            {
                marshalByRefObject = proxyAttribute.CreateInstanceInternal(serverType);
            }
            else
            {
                marshalByRefObject = proxyAttribute.CreateInstance((Type)serverType);
                if (marshalByRefObject != null && !RemotingServices.IsTransparentProxy((object)marshalByRefObject) && !serverType.IsAssignableFrom(marshalByRefObject.GetType()))
                {
                    throw new RemotingException(string.Format((IFormatProvider)CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Activation_BadObject"), (object)serverType));
                }
            }
            return(marshalByRefObject);
        }