AddServerSideDynamicProperty() private method

private AddServerSideDynamicProperty ( IDynamicProperty prop ) : bool
prop IDynamicProperty
return bool
Esempio n. 1
0
        } // RemoveIdentity

        // Support for dynamically registered property sinks
        internal static bool AddDynamicProperty(MarshalByRefObject obj, IDynamicProperty prop)
        {
            if (RemotingServices.IsObjectOutOfContext(obj))
            {
                // We have to add a proxy side property, get the identity
                RealProxy rp = RemotingServices.GetRealProxy(obj);
                return(rp.IdentityObject.AddProxySideDynamicProperty(prop));
            }
            else
            {
                MarshalByRefObject realObj =
                    (MarshalByRefObject)
                    RemotingServices.AlwaysUnwrap((ContextBoundObject)obj);
                // This is a real object. See if we have an identity for it
                ServerIdentity srvID = (ServerIdentity)MarshalByRefObject.GetIdentity(realObj);
                if (srvID != null)
                {
                    return(srvID.AddServerSideDynamicProperty(prop));
                }
                else
                {
                    // identity not found, we can't set a sink for this object.
                    throw new RemotingException(
                              Environment.GetResourceString("Remoting_NoIdentityEntry"));
                }
            }
        }
Esempio n. 2
0
        internal static bool AddDynamicProperty(MarshalByRefObject obj, IDynamicProperty prop)
        {
            if (RemotingServices.IsObjectOutOfContext((object)obj))
            {
                return(RemotingServices.GetRealProxy((object)obj).IdentityObject.AddProxySideDynamicProperty(prop));
            }
            ServerIdentity serverIdentity = (ServerIdentity)MarshalByRefObject.GetIdentity((MarshalByRefObject)RemotingServices.AlwaysUnwrap((ContextBoundObject)obj));

            if (serverIdentity != null)
            {
                return(serverIdentity.AddServerSideDynamicProperty(prop));
            }
            throw new RemotingException(Environment.GetResourceString("Remoting_NoIdentityEntry"));
        }