SetStubData() private method

private SetStubData ( RealProxy rp, Object stubData ) : void
rp RealProxy
stubData Object
return void
Esempio n. 1
0
        // Default implementation of CreateProxy creates an instance of our
        // remoting proxy
        /// <include file='doc\ProxyAttribute.uex' path='docs/doc[@for="ProxyAttribute.CreateProxy"]/*' />

        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);
            }

            // 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);
        }
Esempio n. 2
0
        internal virtual void Wrap()
        {
            ServerIdentity serverIdentity = this._identity as ServerIdentity;

            if (serverIdentity != null && this is RemotingProxy)
            {
                RealProxy.SetStubData(this, serverIdentity.ServerContext.InternalContextID);
            }
        }
Esempio n. 3
0
        internal virtual void Wrap()
        {
            ServerIdentity serverIdentity = this._identity as ServerIdentity;

            if (serverIdentity == null || !(this is RemotingProxy))
            {
                return;
            }
            RealProxy.SetStubData(this, (object)serverIdentity.ServerContext.InternalContextID);
        }
Esempio n. 4
0
 private void SetContextForDefaultStub()
 {
     if (this.GetStub() == RealProxy._defaultStub)
     {
         object stubData = RealProxy.GetStubData(this);
         if (stubData is IntPtr && ((IntPtr)stubData).Equals(RealProxy._defaultStubValue))
         {
             RealProxy.SetStubData(this, Thread.CurrentContext.InternalContextID);
         }
     }
 }
Esempio n. 5
0
        private void SetContextForDefaultStub()
        {
            if (!(this.GetStub() == RealProxy._defaultStub))
            {
                return;
            }
            object stubData = RealProxy.GetStubData(this);

            if (!(stubData is IntPtr) || !((IntPtr)stubData).Equals((object)RealProxy._defaultStubValue))
            {
                return;
            }
            RealProxy.SetStubData(this, (object)Thread.CurrentContext.InternalContextID);
        }
        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);
        }