/// <summary> /// Gets an array of <see cref="T:Microsoft.Practices.CompositeUI.Configuration.IModuleInfo"/> /// enumerated from the source the enumerator is processing. /// </summary> /// <returns> /// An array of <see cref="T:Microsoft.Practices.CompositeUI.Configuration.IModuleInfo"/> instances. /// </returns> public IModuleInfo[] EnumerateModules() { string xml = _moduleInfoStore.GetModuleListXml(); if (String.IsNullOrEmpty(xml)) { return(new DependentModuleInfo[0]); } XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); switch (doc.FirstChild.NamespaceURI) { case SolutionProfileV1Parser.Namespace: return(new SolutionProfileV1Parser().Parse(xml)); case SolutionProfileV2Parser.Namespace: return(new SolutionProfileV2Parser().Parse(xml)); default: throw new InvalidOperationException(Resources.InvalidSolutionProfileSchema); } }
public void LoadModulesFromStore(IModuleInfoStore store) { Validate .Begin() .IsNotNull(store, "store") .Check(); // load modules from XML string xml = store.GetModuleListXml(); if (xml != null) { XmlReaderSettings settings = new XmlReaderSettings(); settings.ConformanceLevel = ConformanceLevel.Document; settings.IgnoreWhitespace = true; settings.IgnoreComments = true; var assemblyNames = GetAssembliesFromXml(xml); // load each assembly LoadAssemblies(assemblyNames); } // now let the IModuleInfoStore directly load assemblies and pass them back var assemblies = store.GetModuleAssemblies(); if (assemblies != null) { foreach (var assembly in assemblies) { LoadAssembly(assembly); } } // now notify all assemblies that all other assemblies are loaded (this is useful when there are module interdependencies NotifyAssembliesOfContainerCompletion(); }