コード例 #1
0
        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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 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);
         }
     }
 }
コード例 #5
0
 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);
         }
     }
 }
コード例 #6
0
        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);
        }
コード例 #7
0
 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);
     }
 }
コード例 #8
0
        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);
            }
        }
コード例 #9
0
 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);    
         }                
     }            
 }
コード例 #10
0
		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;
		}
コード例 #11
0
		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);
			}
		}
コード例 #12
0
        /// <devdoc>
        /// Loads the IConfigurationDesignManager object from the specified Type.
        /// </devdoc>
        internal void Load(Type type)
        {
            ConfigurationDesignManagerProxy proxy = new ConfigurationDesignManagerProxy(type);

            Load(proxy);
        }
コード例 #13
0
        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);
                }

            }
        }
コード例 #14
0
 /// <devdoc>
 /// Loads the IConfigurationDesignManager object from the specified Type.
 /// </devdoc>
 internal void Load(Type type)
 {
     ConfigurationDesignManagerProxy proxy = new ConfigurationDesignManagerProxy(type);
     Load(proxy);
 }