private void InitializeCollectionFacades() { if (_serviceCollection == null) { _serviceCollection = new ServiceCollection( _lifetime, _locator, _builder, _parent == null ? null : _parent.Services); } if (_containerCollection == null) { ManagedObjectCollection <CompositionContainer> parentContainers = (ManagedObjectCollection <CompositionContainer>)(_parent == null ? null : _parent.Containers); _containerCollection = new ManagedObjectCollection <CompositionContainer>( _lifetime, _locator, _builder, SearchMode.Local, null, null, parentContainers); } if (_typeMappings == null) { _typeMappings = new Dictionary <Type, Type>(); } }
/// <summary> /// Initializes an instance of the <see cref="ManagedObjectCollection{TItem}"/> class. /// </summary> public ManagedObjectCollection( ILifetimeContainer container, IReadWriteLocator locator, IBuilder <WCSFBuilderStage> builder, SearchMode searchMode, IndexerCreationDelegate indexerCreationDelegate, Predicate <TItem> filter, ManagedObjectCollection <TItem> parentCollection) { _lifetimeContainer = container; _locator = locator; _builder = builder; _searchMode = searchMode; _indexerCreationDelegate = indexerCreationDelegate; _filter = filter; _parentCollection = parentCollection; _container = locator.Get <CompositionContainer>(new DependencyResolutionLocatorKey(typeof(CompositionContainer), null)); if (_container != null) { _container.ObjectAdded += new EventHandler <DataEventArgs <object> >(Container_ItemAdded); _container.ObjectRemoved += new EventHandler <DataEventArgs <object> >(Container_ItemRemoved); } }