Exemplo n.º 1
0
        public override RealProxy CreateProxy(ObjRef objRef,
                                              Type serverType,
                                              Object serverObject,
                                              Context serverContext)

        {
            DBG.Assert(serverType != null, "server type is null in CreateProxy");

            //
            // If this guy isn't one of our objrefs, then we should use remoting.  Otherwise,
            // go ahead and call GetRealObject on it.
            //
            if (objRef == null)
            {
                return(base.CreateProxy(objRef, serverType, serverObject, serverContext));
            }

            if ((objRef is FastRSCPObjRef) ||
                ((objRef is ServicedComponentMarshaler) &&
                 (!objRef.IsFromThisProcess() || ServicedComponentInfo.IsTypeEventSource(serverType))))
            {
                DBG.Info(DBG.SC, "SCPA: CreateProxy: delegating custom CreateProxy");
                Object otp = objRef.GetRealObject(new StreamingContext(StreamingContextStates.Remoting));
                return(RemotingServices.GetRealProxy(otp));
            }
            else
            {
                DBG.Info(DBG.SC, "SCPA: CreateProxy: delegating standard CreateProxy");
                return(base.CreateProxy(objRef, serverType, serverObject, serverContext));
            }
        }
 public override RealProxy CreateProxy(ObjRef objRef, Type serverType, object serverObject, Context serverContext)
 {
     if (objRef == null)
     {
         return(base.CreateProxy(objRef, serverType, serverObject, serverContext));
     }
     if (!(objRef is FastRSCPObjRef) && (!(objRef is ServicedComponentMarshaler) || (objRef.IsFromThisProcess() && !ServicedComponentInfo.IsTypeEventSource(serverType))))
     {
         return(base.CreateProxy(objRef, serverType, serverObject, serverContext));
     }
     return(RemotingServices.GetRealProxy(objRef.GetRealObject(new StreamingContext(StreamingContextStates.Remoting))));
 }