public IConfigurationSource BuildConFigurationSource()
        {
            List <ConfigurationDesignManagerProxy> alreadyBuilt = new List <ConfigurationDesignManagerProxy>();

            DictionaryConfigurationSource dictionary = new DictionaryConfigurationSource();

            foreach (ConfigurationDesignManagerProxy manager in managers)
            {
                foreach (Type t in manager.DependentTypes)
                {
                    ConfigurationDesignManagerProxy managerProxy = FindProxy(t, manager);
                    if (alreadyBuilt.Contains(managerProxy))
                    {
                        continue;
                    }
                    managerProxy.BuildConfigurationSource(serviceProvider, dictionary);
                    alreadyBuilt.Add(managerProxy);
                }
                if (alreadyBuilt.Contains(manager))
                {
                    continue;
                }
                manager.BuildConfigurationSource(serviceProvider, dictionary);
                alreadyBuilt.Add(manager);
            }
            return(dictionary);
        }
        /// <devdoc>
        /// Loads the IConfigurationDesignManager object from the specified Type.
        /// </devdoc>
        internal void Load(Type type, Type dependentType)
        {
            ConfigurationDesignManagerProxy foundProxy = managers.Find(delegate(ConfigurationDesignManagerProxy proxyFromList) { return(proxyFromList.ConfigurationDesignManager.GetType() == type); });

            ConfigurationDesignManagerProxy proxy = (foundProxy == null) ? new ConfigurationDesignManagerProxy(type) : foundProxy;

            if (null != dependentType)
            {
                proxy.DependentTypes.Add(dependentType);
            }
            Load(proxy);
        }
 public void Register()
 {
     foreach (ConfigurationDesignManagerProxy manager in managers)
     {
         foreach (Type t in manager.DependentTypes)
         {
             ConfigurationDesignManagerProxy managerProxy = FindProxy(t, manager);
             managerProxy.Register(serviceProvider);
         }
         manager.Register(serviceProvider);
     }
 }
 internal void Load(ConfigurationDesignManagerProxy proxy)
 {
     if (!managers.Contains(proxy))
     {
         // source manager has to be first
         if (proxy.ConfigurationDesignManager.GetType().Equals(typeof(ConfigurationSourceConfigurationDesignManager)))
         {
             this.managers.Insert(0, proxy);
         }
         else
         {
             this.managers.Add(proxy);
         }
     }
 }
 internal void Load(ConfigurationDesignManagerProxy proxy)
 {
     if (!managers.Contains(proxy))
     {
         // our manager should allways be the fist in the list
         if (proxy.ConfigurationDesignManager.GetType().Equals(typeof(ConfigurationDesignManager)))
         {
             this.managers.Insert(0, proxy);
         }
         else
         {
             this.managers.Add(proxy);
         }
     }
 }
        private ConfigurationDesignManagerProxy FindProxy(Type t, ConfigurationDesignManagerProxy manager)
        {
            ConfigurationDesignManagerProxy managerProxy = managers.Find(delegate(ConfigurationDesignManagerProxy proxy)
            {
                if (proxy.ConfigurationDesignManager.GetType() == t)
                {
                    return(true);
                }
                return(false);
            });

            if (null == managerProxy)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentUICulture, Resources.ExceptionManagerDependencyNotFound, manager.ConfigurationDesignManager.GetType().Name, t.Name));
            }
            return(managerProxy);
        }
 private void LoadDependentTypes(List <ConfigurationDesignManagerProxy> alreadyOpened, ConfigurationDesignManagerProxy manager)
 {
     foreach (Type t in manager.DependentTypes)
     {
         ConfigurationDesignManagerProxy managerProxy = FindProxy(t, manager);
         if (alreadyOpened.Contains(managerProxy))
         {
             continue;
         }
         if (manager.DependentTypes.Count > 0)
         {
             LoadDependentTypes(alreadyOpened, managerProxy);
         }
         managerProxy.Open(serviceProvider);
         alreadyOpened.Add(managerProxy);
     }
 }
        public void Save()
        {
            List <ConfigurationDesignManagerProxy> alreadySaved = new List <ConfigurationDesignManagerProxy>();

            foreach (ConfigurationDesignManagerProxy manager in managers)
            {
                foreach (Type t in manager.DependentTypes)
                {
                    ConfigurationDesignManagerProxy managerProxy = FindProxy(t, manager);
                    if (alreadySaved.Contains(managerProxy))
                    {
                        continue;
                    }
                    managerProxy.Save(serviceProvider);
                    alreadySaved.Add(managerProxy);
                }
                if (alreadySaved.Contains(manager))
                {
                    continue;
                }
                manager.Save(serviceProvider);
                alreadySaved.Add(manager);
            }
        }
 internal void Load(ConfigurationDesignManagerProxy proxy)
 {
     if (!managers.Contains(proxy))
     {
         // source manager has to be first
         if (proxy.ConfigurationDesignManager.GetType().Equals(typeof(ConfigurationSourceConfigurationDesignManager)))
         {
             this.managers.Insert(0, proxy);
         }
         else
         {
             this.managers.Add(proxy);    
         }                
     }            
 }
		private ConfigurationDesignManagerProxy FindProxy(Type t, ConfigurationDesignManagerProxy manager)
		{
			ConfigurationDesignManagerProxy managerProxy = managers.Find(delegate(ConfigurationDesignManagerProxy proxy)
																			   {
																				   if (proxy.ConfigurationDesignManager.GetType() == t)
																				   {
																					   return true;
																				   }
																				   return false;
																			   });
			if (null == managerProxy) throw new InvalidOperationException(string.Format(CultureInfo.CurrentUICulture, Resources.ExceptionManagerDependencyNotFound, manager.ConfigurationDesignManager.GetType().Name, t.Name));
			return managerProxy;
		}
		private void LoadDependentTypes(List<ConfigurationDesignManagerProxy> alreadyOpened, ConfigurationDesignManagerProxy manager)
		{
			foreach (Type t in manager.DependentTypes)
			{
				ConfigurationDesignManagerProxy managerProxy = FindProxy(t, manager);
				if (alreadyOpened.Contains(managerProxy)) continue;
				if (manager.DependentTypes.Count > 0) LoadDependentTypes(alreadyOpened, managerProxy);
				managerProxy.Open(serviceProvider);
				alreadyOpened.Add(managerProxy);
			}
		}
        /// <devdoc>
        /// Loads the IConfigurationDesignManager object from the specified Type.
        /// </devdoc>
        internal void Load(Type type)
        {
            ConfigurationDesignManagerProxy proxy = new ConfigurationDesignManagerProxy(type);

            Load(proxy);
        }
        internal void Load(ConfigurationDesignManagerProxy proxy)
        {
            if (!managers.Contains(proxy))
            {
                // our manager should allways be the fist in the list
                if (proxy.ConfigurationDesignManager.GetType().Equals(typeof(ConfigurationDesignManager)))
                {
                    this.managers.Insert(0, proxy);
                }
                else
                {
                    this.managers.Add(proxy);
                }

            }
        }
 /// <devdoc>
 /// Loads the IConfigurationDesignManager object from the specified Type.
 /// </devdoc>
 internal void Load(Type type)
 {
     ConfigurationDesignManagerProxy proxy = new ConfigurationDesignManagerProxy(type);
     Load(proxy);
 }