internal static bool RemoveDynamicProperty(MarshalByRefObject obj, String name) { if (RemotingServices.IsObjectOutOfContext(obj)) { // We have to add a proxy side property, get the identity RealProxy rp = RemotingServices.GetRealProxy(obj); return(rp.IdentityObject.RemoveProxySideDynamicProperty(name)); } 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.RemoveServerSideDynamicProperty(name)); } else { // identity not found, we can't set a sink for this object. throw new RemotingException( Environment.GetResourceString("Remoting_NoIdentityEntry")); } } }
internal static bool AddDynamicProperty(MarshalByRefObject obj, IDynamicProperty prop) { if (RemotingServices.IsObjectOutOfContext(obj)) { return(RemotingServices.GetRealProxy(obj).IdentityObject.AddProxySideDynamicProperty(prop)); } MarshalByRefObject obj2 = (MarshalByRefObject)RemotingServices.AlwaysUnwrap((ContextBoundObject)obj); ServerIdentity identity = (ServerIdentity)MarshalByRefObject.GetIdentity(obj2); if (identity == null) { throw new RemotingException(Environment.GetResourceString("Remoting_NoIdentityEntry")); } return(identity.AddServerSideDynamicProperty(prop)); }
internal static bool RemoveDynamicProperty(MarshalByRefObject obj, string name) { if (RemotingServices.IsObjectOutOfContext(obj)) { RealProxy realProxy = RemotingServices.GetRealProxy(obj); return(realProxy.IdentityObject.RemoveProxySideDynamicProperty(name)); } MarshalByRefObject obj2 = (MarshalByRefObject)RemotingServices.AlwaysUnwrap((ContextBoundObject)obj); ServerIdentity serverIdentity = (ServerIdentity)MarshalByRefObject.GetIdentity(obj2); if (serverIdentity != null) { return(serverIdentity.RemoveServerSideDynamicProperty(name)); } throw new RemotingException(Environment.GetResourceString("Remoting_NoIdentityEntry")); }