public virtual bool HasComponent(Type serviceType) { if (serviceType == null) { return(false); } if (NamingSubSystem.Contains(serviceType)) { return(true); } return(Parent != null && Parent.HasComponent(serviceType)); }
public virtual bool HasComponent(string name) { if (name == null) { return(false); } if (NamingSubSystem.Contains(name)) { return(true); } return(Parent != null && Parent.HasComponent(name)); }
public virtual bool RemoveComponent(String key) { if (key == null) { throw new ArgumentNullException("key"); } if (NamingSubSystem.Contains(key)) { IHandler handler = GetHandler(key); if (handler.ComponentModel.Dependers.Length == 0) { NamingSubSystem.UnRegister(key); if (GetHandler(handler.ComponentModel.Service) == handler) { NamingSubSystem.UnRegister(handler.ComponentModel.Service); } foreach (ComponentModel model in handler.ComponentModel.Dependents) { model.RemoveDepender(handler.ComponentModel); } RaiseComponentUnregistered(key, handler); DisposeHandler(handler); return(true); } else { // We can't remove this component as there are // others which depends on it return(false); } } if (Parent != null) { return(Parent.RemoveComponent(key)); } return(false); }
public virtual bool HasComponent(Type serviceType) { if (serviceType == null) { throw new ArgumentNullException("serviceType"); } if (NamingSubSystem.Contains(serviceType)) { return(true); } if (Parent != null) { return(Parent.HasComponent(serviceType)); } return(false); }
public virtual bool HasComponent(String key) { if (key == null) { throw new ArgumentNullException("key"); } if (NamingSubSystem.Contains(key)) { return(true); } if (Parent != null) { return(Parent.HasComponent(key)); } return(false); }
private void DisposeHandlers() { GraphNode[] nodes = GraphNodes; IVertex[] vertices = TopologicalSortAlgo.Sort(nodes); for (int i = 0; i < vertices.Length; i++) { ComponentModel model = (ComponentModel)vertices[i]; // Prevent the removal of a component that belongs // to other container if (!NamingSubSystem.Contains(model.Name)) { continue; } bool successOnRemoval = RemoveComponent(model.Name); System.Diagnostics.Debug.Assert(successOnRemoval); } }