Example #1
0
        internal void AttachIdentity(Identity identity)
        {
            _objectIdentity = identity;

            if (identity is ClientActivatedIdentity)    // It is a CBO
            {
                ClientActivatedIdentity cai = (ClientActivatedIdentity)identity;
                _targetContext = cai.Context;
                AttachServer(cai.GetServerObject());
                cai.SetClientProxy((MarshalByRefObject)GetTransparentProxy());
            }

            if (identity is ClientIdentity)
            {
                ((ClientIdentity)identity).ClientProxy = (MarshalByRefObject)GetTransparentProxy();
                _targetUri = ((ClientIdentity)identity).TargetUri;
            }
            else
            {
                _targetUri = identity.ObjectUri;
            }

            if (_objectIdentity.EnvoySink != null)
            {
                _sink         = _objectIdentity.EnvoySink;
                _hasEnvoySink = true;
            }
            else
            {
                _sink = _objectIdentity.ChannelSink;
            }

            _ctorCall = null;   // Object already constructed
        }
 internal void AttachIdentity(Identity identity)
 {
     this._objectIdentity = identity;
     if (identity is ClientActivatedIdentity)
     {
         ClientActivatedIdentity clientActivatedIdentity = (ClientActivatedIdentity)identity;
         this._targetContext = clientActivatedIdentity.Context;
         base.AttachServer(clientActivatedIdentity.GetServerObject());
         clientActivatedIdentity.SetClientProxy((MarshalByRefObject)this.GetTransparentProxy());
     }
     if (identity is ClientIdentity)
     {
         ((ClientIdentity)identity).ClientProxy = (MarshalByRefObject)this.GetTransparentProxy();
         this._targetUri = ((ClientIdentity)identity).TargetUri;
     }
     else
     {
         this._targetUri = identity.ObjectUri;
     }
     if (this._objectIdentity.EnvoySink != null)
     {
         this._sink         = this._objectIdentity.EnvoySink;
         this._hasEnvoySink = true;
     }
     else
     {
         this._sink = this._objectIdentity.ChannelSink;
     }
     this._ctorCall = null;
 }