Esempio n. 1
0
        /// <include file='doc\ConfigurationSettings.uex' path='docs/doc[@for="ConfigurationSettings.SetConfigurationSystem"]/*' />
        /// <devdoc>
        ///     Called by ASP.NET to allow hierarchical configuration settings and ASP.NET specific extenstions.
        /// </devdoc>
        internal static void SetConfigurationSystem(IConfigurationSystem configSystem)
        {
#if LIB
            _configSystem = configSystem; // avoid warning in LIB build pass
#else
            lock (typeof(ConfigurationSettings)) {
                if (_configSystem == null)
                {
                    try {
                        _configSystem = configSystem;
                        configSystem.Init();
                    }
                    catch (Exception e) {
                        _initError = e;
                        throw;
                    }
                }
                else
                {
                    throw new InvalidOperationException(SR.GetString(SR.Config_system_already_set));
                }

                _configurationInitialized = true;
            }
#endif
        }
		// Invoked from System.Web, disable warning
		internal static IConfigurationSystem ChangeConfigurationSystem (IConfigurationSystem newSystem)
		{
			if (newSystem == null)
				throw new ArgumentNullException ("newSystem");

			lock (lockobj) {
				IConfigurationSystem old = config;
				config = newSystem;
				return old;
			}
		}
Esempio n. 3
0
        // Invoked from System.Web, disable warning
        internal static IConfigurationSystem ChangeConfigurationSystem(IConfigurationSystem newSystem)
        {
            if (newSystem == null)
            {
                throw new ArgumentNullException("newSystem");
            }

            lock (lockobj) {
                IConfigurationSystem old = config;
                config = newSystem;
                return(old);
            }
        }
        internal static void Init()
        {
            lock (lockobj)
            {
                if (config != null)
                {
                    return;
                }

                /* deal with the ConfigurationSettings stuff */
                {
                    Web20DefaultConfig settings = Web20DefaultConfig.GetInstance();
                    Type       t            = typeof(ConfigurationSettings);
                    MethodInfo changeConfig = t.GetMethod("ChangeConfigurationSystem",
                                                          privStatic);

                    if (changeConfig == null)
                    {
                        throw new ConfigurationException("Cannot find method CCS");
                    }

                    object [] args = new object [] { settings };
                    oldConfig = (IConfigurationSystem)changeConfig.Invoke(null, args);
                    config    = settings;

                    config.Init();
                }

                /* deal with the ConfigurationManager stuff */
                {
                    HttpConfigurationSystem system = new HttpConfigurationSystem();
                    Type       t            = typeof(ConfigurationManager);
                    MethodInfo changeConfig = t.GetMethod("ChangeConfigurationSystem",
                                                          privStatic);

                    if (changeConfig == null)
                    {
                        throw new ConfigurationException("Cannot find method CCS");
                    }

                    object [] args = new object [] { system };
                    changeConfig.Invoke(null, args);
                    //configSystem = system;
                }
            }
        }
		public static void Init ()
		{
			lock (lockobj) {
				if (config != null)
					return;

				WebDefaultConfig settings = WebDefaultConfig.GetInstance ();
				Type t = typeof (ConfigurationSettings);
				MethodInfo changeConfig = t.GetMethod ("ChangeConfigurationSystem",
								      privStatic);

				if (changeConfig == null)
					throw new ConfigurationException ("Cannot find method CCS");

				object [] args = new object [] {settings};
				oldConfig = (IConfigurationSystem) changeConfig.Invoke (null, args);
				config = settings;
			}
		}
Esempio n. 6
0
        internal static void SetConfigurationSystem(IConfigurationSystem ConfigSystem)
        {
            lock (typeof(ConfigurationSettings))
            {
                if (configSystem != null)
                {
                    throw new InvalidOperationException("Config system already set");
                }

                try
                {
                    configSystem = ConfigSystem;
                    configSystem.Init();
                }
                catch (Exception e)
                {
                    initError = e;
                    throw;
                }

                configurationInitialized = true;
            }
        }
Esempio n. 7
0
        /// <include file='doc\ConfigurationSettings.uex' path='docs/doc[@for="ConfigurationSettings.SetConfigurationSystem"]/*' />
        /// <devdoc>
        ///     Called by ASP.NET to allow hierarchical configuration settings and ASP.NET specific extenstions.
        /// </devdoc>
        internal static void SetConfigurationSystem(IConfigurationSystem configSystem) {
#if LIB
            _configSystem = configSystem; // avoid warning in LIB build pass
#else
            lock(typeof(ConfigurationSettings)) {
                if (_configSystem == null) {
                    try {
                        _configSystem = configSystem;
                        configSystem.Init();
                    }
                    catch (Exception e) {
                        _initError = e;
                        throw;
                    }
                }
                else {
                    throw new InvalidOperationException(SR.GetString(SR.Config_system_already_set));
                }

                _configurationInitialized = true;
            }
#endif
        }
Esempio n. 8
0
        public static void Init()
        {
            lock (lockobj) {
                if (config != null)
                {
                    return;
                }

                WebDefaultConfig settings     = WebDefaultConfig.GetInstance();
                Type             t            = typeof(ConfigurationSettings);
                MethodInfo       changeConfig = t.GetMethod("ChangeConfigurationSystem",
                                                            privStatic);

                if (changeConfig == null)
                {
                    throw new ConfigurationException("Cannot find method CCS");
                }

                object [] args = new object [] { settings };
                oldConfig = (IConfigurationSystem)changeConfig.Invoke(null, args);
                config    = settings;
            }
        }
		internal static void SetConfigurationSystem(IConfigurationSystem ConfigSystem)
		{
			lock(typeof(ConfigurationSettings))
			{
				if (configSystem != null)
				{
					throw new InvalidOperationException("Config system already set");
				}
			
				try
				{
					configSystem = ConfigSystem;
					configSystem.Init();
				}
				catch (Exception e)
				{
					initError = e;
					throw;
				}
				
				configurationInitialized = true;
			}
		}
Esempio n. 10
0
 /// <summary>
 /// Forces the settings provider to re-load the settings from the configuration file.
 /// </summary>
 public static void Reload()
 {
     m_configurationInitialized = false;
     m_configSystem             = null;
 }
Esempio n. 11
0
		internal static void Init ()
		{
			lock (lockobj) {
				if (config != null)
					return;

				/* deal with the ConfigurationSettings stuff */
				{
					Web20DefaultConfig settings = Web20DefaultConfig.GetInstance ();
					Type t = typeof (ConfigurationSettings);
					MethodInfo changeConfig = t.GetMethod ("ChangeConfigurationSystem",
									       privStatic);

					if (changeConfig == null)
						throw new ConfigurationException ("Cannot find method CCS");

					object [] args = new object [] {settings};
					oldConfig = (IConfigurationSystem)changeConfig.Invoke (null, args);
					config = settings;

					config.Init ();
				}

				/* deal with the ConfigurationManager stuff */
				{
					HttpConfigurationSystem system = new HttpConfigurationSystem ();
					Type t = typeof (ConfigurationManager);
					MethodInfo changeConfig = t.GetMethod ("ChangeConfigurationSystem",
									       privStatic);

					if (changeConfig == null)
						throw new ConfigurationException ("Cannot find method CCS");

					object [] args = new object [] {system};
					changeConfig.Invoke (null, args);
					//configSystem = system;
				}
			}
		}
Esempio n. 12
0
        }; // class BuiltinConfigurationSystem

        /* This is a stupid API simulated to satisfy System.Web implementation */
        internal static IConfigurationSystem ChangeConfigurationSystem(IConfigurationSystem config)
        {
            return(configSystem);
        }
	}; // class BuiltinConfigurationSystem

	/* This is a stupid API simulated to satisfy System.Web implementation */
	internal static IConfigurationSystem ChangeConfigurationSystem(IConfigurationSystem config)
	{
		return configSystem;
	}
 public SectionProvider(ISectionNameConvention nameConvention, IConfigurationSystem configurationSystem)
 {
     _nameConvention      = nameConvention;
     _configurationSystem = configurationSystem;
 }