public virtual RealProxy CreateProxy(ObjRef objRef, Type serverType, object serverObject, Context serverContext)
        {
            RemotingProxy remotingProxy = new RemotingProxy(serverType);

            if (serverContext != null)
            {
                RealProxy.SetStubData(remotingProxy, serverContext.InternalContextID);
            }
            if (objRef != null && objRef.GetServerIdentity().IsAllocated)
            {
                remotingProxy.SetSrvInfo(objRef.GetServerIdentity(), objRef.GetDomainID());
            }
            remotingProxy.Initialized = true;
            if (!serverType.IsContextful && !serverType.IsMarshalByRef && serverContext != null)
            {
                throw new RemotingException(Environment.GetResourceString("Remoting_Activation_MBR_ProxyAttribute"));
            }
            return(remotingProxy);
        }
Beispiel #2
0
        // Default implementation of CreateProxy creates an instance of our
        // remoting proxy

        public virtual RealProxy CreateProxy(ObjRef objRef,
                                             Type serverType,
                                             Object serverObject,
                                             Context serverContext)
        {
            RemotingProxy rp = new RemotingProxy(serverType);

            // If this is a serverID, set the native context field in the TP
            if (null != serverContext)
            {
                RealProxy.SetStubData(rp, serverContext.InternalContextID);
            }

            if (objRef != null && objRef.GetServerIdentity().IsAllocated)
            {
                rp.SetSrvInfo(objRef.GetServerIdentity(), objRef.GetDomainID());
            }

            // Set the flag indicating that the fields of the proxy
            // have been initialized
            rp.Initialized = true;

            // Sanity check
            Type t = serverType;

            if (!t.IsContextful &&
                !t.IsMarshalByRef &&
                (null != serverContext))
            {
                throw new RemotingException(
                          Environment.GetResourceString(
                              "Remoting_Activation_MBR_ProxyAttribute"));
            }

            return(rp);
        }
Beispiel #3
0
        [System.Security.SecurityCritical]  // auto-generated 
        public virtual RealProxy CreateProxy(ObjRef objRef,
                                             Type serverType, 
                                             Object serverObject,
                                             Context serverContext)
        {
            RemotingProxy rp =  new RemotingProxy(serverType); 

            // If this is a serverID, set the native context field in the TP 
            if (null != serverContext) 
            {
                RealProxy.SetStubData(rp, serverContext.InternalContextID); 
            }

            if (objRef != null && objRef.GetServerIdentity().IsAllocated)
            { 
                rp.SetSrvInfo(objRef.GetServerIdentity(), objRef.GetDomainID());
            } 
 
            // Set the flag indicating that the fields of the proxy
            // have been initialized 
            rp.Initialized = true;

            // Sanity check
            Type t = serverType; 
            if (!t.IsContextful &&
                !t.IsMarshalByRef && 
                (null != serverContext)) 
            {
                throw new RemotingException( 
                    Environment.GetResourceString(
                        "Remoting_Activation_MBR_ProxyAttribute"));
            }
 
            return rp;
        }