public void TearDown(object instance) { _log.Debug("Teardown instance of type [{0}]", instance.GetType().FullName); IObjectBuildContext ctx; if (_lifecycleContainer.TryRemove(instance, out ctx)) { _log.Debug("[{0}] is going to teardown.", instance); _b.TearDown(instance, ctx); } else { _log.Debug("[{0}] is going to dispose.", instance); IDisposable d = instance as IDisposable; if (d != null) { d.Dispose(); } } }