Пример #1
0
        } // ObjectMode

        public virtual IMessage SyncProcessMessage(IMessage msg)
        {
            IMessage replyMsg = null;

            try
            {
                msg.Properties["__Uri"] = _realProxy.IdentityObject.URI;

                if (_objectMode == WellKnownObjectMode.Singleton)
                {
                    replyMsg = _realProxy.Invoke(msg);
                }
                else
                {
                    // This is a single call object, so we need to create
                    // a new instance.
                    MarshalByRefObject obj = (MarshalByRefObject)Activator.CreateInstance(_serverType, true);
                    BCLDebug.Assert(RemotingServices.IsTransparentProxy(obj), "expecting a proxy");

                    RealProxy rp = RemotingServices.GetRealProxy(obj);
                    replyMsg = rp.Invoke(msg);
                }
            }
            catch (Exception e)
            {
                replyMsg = new ReturnMessage(e, msg as IMethodCallMessage);
            }

            return(replyMsg);
        } // SyncProcessMessage
Пример #2
0
 public static IMethodReturnMessage ExecuteMessage(
     MarshalByRefObject target, IMethodCallMessage reqMsg)
 {
     if (IsTransparentProxy(target))
     {
         // Message must go through all chain of sinks
         RealProxy rp = GetRealProxy(target);
         return((IMethodReturnMessage)rp.Invoke(reqMsg));
     }
     else                // Direct call
     {
         return(InternalExecuteMessage(target, reqMsg));
     }
 }
Пример #3
0
        public virtual IMessage SyncProcessMessage(IMessage msg)
        {
            IMessage result = null;

            try
            {
                msg.Properties["__Uri"] = this._realProxy.IdentityObject.URI;
                if (this._objectMode == WellKnownObjectMode.Singleton)
                {
                    result = this._realProxy.Invoke(msg);
                }
                else
                {
                    MarshalByRefObject proxy     = (MarshalByRefObject)Activator.CreateInstance(this._serverType, true);
                    RealProxy          realProxy = RemotingServices.GetRealProxy(proxy);
                    result = realProxy.Invoke(msg);
                }
            }
            catch (Exception e)
            {
                result = new ReturnMessage(e, msg as IMethodCallMessage);
            }
            return(result);
        }