RaceSetTransparentProxy() private méthode

private RaceSetTransparentProxy ( Object tpObj ) : Object
tpObj Object
Résultat Object
        [System.Security.SecurityCritical]  // auto-generated
        private static MarshalByRefObject SetOrCreateProxy( 
            Identity idObj, Type classToProxy, Object proxy)
 
        { 
            Message.DebugOut("Entering SetOrCreateProxy for type \n");
 
            RealProxy realProxy = null;
            // If a proxy has not been supplied create one
            if (null == proxy)
            { 
                // Create a remoting proxy
                Message.DebugOut("SetOrCreateProxy::Creating Proxy for " + 
                                 classToProxy.FullName + "\n"); 

                ServerIdentity srvID = idObj as ServerIdentity; 
                if (idObj.ObjectRef != null)
                {
                    ProxyAttribute pa = ActivationServices.GetProxyAttribute(classToProxy);
                    realProxy = pa.CreateProxy(idObj.ObjectRef, 
                                           classToProxy,
                                           null,  // 
                                           null); // 
                }
                if(null == realProxy) 
                {
                    // The custom proxy attribute does not want to create a proxy. We create a default
                    // proxy in this case.
                    ProxyAttribute defaultProxyAttribute = ActivationServices.DefaultProxyAttribute; 

                    realProxy = defaultProxyAttribute.CreateProxy(idObj.ObjectRef, 
                                                                  classToProxy, 
                                                                  null,
                                                                  (null == srvID ? null : 
                                                                                   srvID.ServerContext));
                }
            }
            else 
            {
                BCLDebug.Assert(IsTransparentProxy(proxy),"IsTransparentProxy(proxy)"); 
 
                // Extract the remoting proxy from the transparent proxy
                Message.DebugOut("SetOrCreateProxy::Proxy already created \n"); 
                realProxy = GetRealProxy(proxy);
            }

            BCLDebug.Assert(null != realProxy,"null != realProxy"); 

            // Set the back reference to the identity in the proxy object 
            realProxy.IdentityObject = idObj; 

            // Set the reference to the proxy in the identity object 
            proxy = realProxy.GetTransparentProxy();
            proxy = idObj.RaceSetTransparentProxy(proxy);

            Message.DebugOut("Leaving SetOrCreateProxy\n"); 
            // return the transparent proxy
            return (MarshalByRefObject)proxy; 
        } 
 private static MarshalByRefObject SetOrCreateProxy(Identity idObj, Type classToProxy, object proxy)
 {
     RealProxy realProxy = null;
     if (proxy == null)
     {
         ServerIdentity identity = idObj as ServerIdentity;
         if (idObj.ObjectRef != null)
         {
             realProxy = ActivationServices.GetProxyAttribute(classToProxy).CreateProxy(idObj.ObjectRef, classToProxy, null, null);
         }
         if (realProxy == null)
         {
             realProxy = ActivationServices.DefaultProxyAttribute.CreateProxy(idObj.ObjectRef, classToProxy, null, (identity == null) ? null : identity.ServerContext);
         }
     }
     else
     {
         realProxy = GetRealProxy(proxy);
     }
     realProxy.IdentityObject = idObj;
     proxy = realProxy.GetTransparentProxy();
     proxy = idObj.RaceSetTransparentProxy(proxy);
     return (MarshalByRefObject) proxy;
 }