// Set the URI to use to marshal an object. public static void SetObjectUriForMarshal (MarshalByRefObject obj, String uri) { if (obj == null) { return; } Identity id = obj.GetIdentity(); if (id != null) { // Update the object's current identity. if (id.otherAppDomain) { throw new RemotingException(_("Remoting_NotLocal")); } if (id.uri != null) { throw new RemotingException(_("Remoting_HasIdentity")); } id.uri = uri; } else { // Create a new identity for the object and set it. id = new Identity(); id.uri = uri; id.context = Thread.CurrentContext; id.otherAppDomain = false; obj.SetIdentity(id); } }
// Set the URI to use to marshal an object. public static void SetObjectUriForMarshal (MarshalByRefObject obj, String uri) { if(obj == null) { return; } Identity id = obj.GetIdentity(); if(id != null) { // Update the object's current identity. if(id.otherAppDomain) { throw new RemotingException(_("Remoting_NotLocal")); } if(id.uri != null) { throw new RemotingException(_("Remoting_HasIdentity")); } id.uri = uri; } else { // Create a new identity for the object and set it. id = new Identity(); id.uri = uri; id.context = Thread.CurrentContext; id.otherAppDomain = false; obj.SetIdentity(id); } }