System.Runtime.Remoting.Identity.RaceSetTransparentProxy C# (CSharp) Méthode

RaceSetTransparentProxy() private méthode

private RaceSetTransparentProxy ( Object tpObj ) : Object
tpObj Object
Résultat Object
        internal Object  RaceSetTransparentProxy(Object tpObj)
        {
            if (_tpOrObject == null)
                Interlocked.CompareExchange(ref _tpOrObject, tpObj, null);
            return _tpOrObject;
        }

Usage Example

        [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; 
        } 
All Usage Examples Of System.Runtime.Remoting.Identity::RaceSetTransparentProxy