/// <include file='doc\ServicedComponent.uex' path='docs/doc[@for="ServicedComponent.DisposeObject"]/*' /> public static void DisposeObject(ServicedComponent sc) { RealProxy rp = RemotingServices.GetRealProxy(sc); if (rp is ServicedComponentProxy) { DBG.Info(DBG.SC, "DisposeObject(): Disposing ServicedComponentProxy"); ServicedComponentProxy scp = (ServicedComponentProxy)rp; RemotingServices.Disconnect(sc); // dispose the actual proxy scp.Dispose(true); } else if (rp is RemoteServicedComponentProxy) { DBG.Info(DBG.SC, "DisposeObject(): Disposing RemoteServicedComponentProxy"); RemoteServicedComponentProxy rscp = (RemoteServicedComponentProxy)rp; // dispose the remote instance first sc.Dispose(); // then dispose the local proxy rscp.Dispose(true); } else // We're off in magic land, with no proxy of our own. { sc.Dispose(); } }
public static void DisposeObject(ServicedComponent sc) { RealProxy realProxy = RemotingServices.GetRealProxy(sc); if (realProxy is ServicedComponentProxy) { ServicedComponentProxy proxy2 = (ServicedComponentProxy)realProxy; RemotingServices.Disconnect(sc); proxy2.Dispose(true); } else if (realProxy is RemoteServicedComponentProxy) { RemoteServicedComponentProxy proxy3 = (RemoteServicedComponentProxy)realProxy; sc.Dispose(); proxy3.Dispose(true); } else { sc.Dispose(); } }