private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects). if (this._hostsSlot != null) { foreach (var host in this._hostsSlot.Hosts) { host.Close(); } this._hostsSlot = null; } if (this._hostFactory != null) { this._hostFactory = null; this.Logger.Info("AppServer: The tech service host has been closed"); } } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
public TechServicesHost(ITechServiceHostsSlot hostsSlot, IWindsorContainer container, ILogger logger) : base(logger) { this._hostsSlot = hostsSlot; this._container = container; this._hostFactory = new DefaultServiceHostFactory(this._container.Kernel); foreach (var host in this._hostsSlot.Hosts) { host.Install(container); } }