internal void Init(IConfigSystem system, string configPath, Configuration parent) { this.system = system; this.configPath = configPath; streamName = system.Host.GetStreamName(configPath); this.parent = parent; if (parent != null) { rootGroup = parent.rootGroup; } else { rootGroup = new SectionGroupInfo(); rootGroup.StreamName = streamName; } try { if (streamName != null) { Load(); } } catch (XmlException ex) { throw new ConfigurationErrorsException(ex.Message, ex, streamName, 0); } }
internal Configuration(Configuration parent, string locationSubPath) { this.parent = parent; this.system = parent.system; this.rootGroup = parent.rootGroup; this.locationSubPath = locationSubPath; }
internal Configuration (Configuration parent, string locationSubPath) { this.parent = parent; this.system = parent.system; this.rootGroup = parent.rootGroup; this.locationSubPath = locationSubPath; this.configPath = parent.ConfigPath; }
internal Configuration(Configuration parent, string locationSubPath) { Parent = parent; _system = parent._system; _rootGroup = parent._rootGroup; _locationSubPath = locationSubPath; _configPath = parent.ConfigPath; }
internal ClientConfigurationSystem() { _configSystem = new ConfigSystem(); _configSystem.Init(typeof(ClientConfigurationHost), null, null); _configHost = (ClientConfigurationHost) _configSystem.Host; _configRoot = _configSystem.Root; _configRoot.ConfigRemoved += OnConfigRemoved; _isAppConfigHttp = _configHost.IsAppConfigHttp; }
internal ClientConfigurationSystem() { _configSystem = new ConfigSystem(); _configSystem.Init(typeof(ClientConfigurationHost), null, null); _configHost = (ClientConfigurationHost)_configSystem.Host; _configRoot = _configSystem.Root; _configRoot.ConfigRemoved += OnConfigRemoved; _isAppConfigHttp = _configHost.IsAppConfigHttp; }
/// <summary> /// Constructor using the config system instance /// </summary> /// <param name="pathIn"> Path to the input/output file</param> /// <param name="configSystemIn"> An instance of your desired configuration system.</param> public CfgManager(string pathIn, IConfigSystem configSystemIn) { this.Log().Debug(string.Format("Creating a configuration manager from file \"{0}\" with habdler of type: {1}", pathIn, configSystemIn.ToString())); if (!File.Exists(pathIn)) { this.Log().Info("File requested for config doesn't exist."); } path = pathIn; configSystem = configSystemIn; content = new Dictionary <string, string>(); }
internal Configuration (InternalConfigurationSystem system, string locationSubPath) { hasFile = true; this.system = system; system.InitForConfiguration (ref locationSubPath, out configPath, out locationConfigPath); Configuration parent = null; if (locationSubPath != null) { parent = new Configuration (system, locationSubPath); if (locationConfigPath != null) parent = parent.FindLocationConfiguration (locationConfigPath, parent); } Init (system, configPath, parent); }
internal ClientConfigurationSystem() { _configSystem = new ConfigSystem(); _configSystem.Init(typeof(ClientConfigurationHost), null, null); _configHost = (ClientConfigurationHost) _configSystem.Host; _configRoot = _configSystem.Root; _configRoot.ConfigRemoved += OnConfigRemoved; _isAppConfigHttp = _configHost.IsAppConfigHttp; // VSWhidbey 606116: Config has a dependency on Uri class which has // a new static constructor that calls config. We need a dummy reference // to Uri class so the static constructor would be involved first to // initialize config. string dummy = System.Uri.SchemeDelimiter; }
internal ClientConfigurationSystem() { _configSystem = new ConfigSystem(); _configSystem.Init(typeof(ClientConfigurationHost), null, null); _configHost = (ClientConfigurationHost)_configSystem.Host; _configRoot = _configSystem.Root; _configRoot.ConfigRemoved += OnConfigRemoved; _isAppConfigHttp = _configHost.IsAppConfigHttp; // VSWhidbey 606116: Config has a dependency on Uri class which has // a new static constructor that calls config. We need a dummy reference // to Uri class so the static constructor would be involved first to // initialize config. string dummy = System.Uri.SchemeDelimiter; }
private SectionInfo CreateSectionInfo(IConfigSystem system, string configPath, string sectionName, string sectionType) { var sectionInformation = new SectionInformation { Type = sectionType, ConfigFilePath = configPath }; sectionInformation.SetName(sectionName); var sectionInfo = new SectionInfo(sectionName, sectionInformation) { StreamName = FileName, ConfigHost = system.Host }; return(sectionInfo); }
internal Configuration(InternalConfigurationSystem system, string locationSubPath) { hasFile = true; this.system = system; system.InitForConfiguration(ref locationSubPath, out configPath, out locationConfigPath); Configuration parent = null; if (locationSubPath != null) { parent = new Configuration(system, locationSubPath); if (locationConfigPath != null) { parent = parent.FindLocationConfiguration(locationConfigPath, parent); } } Init(system, configPath, parent); }
internal void Init(IConfigSystem system, string configPath, Configuration parent) { this.system = system; this.configPath = configPath; streamName = system.Host.GetStreamName(configPath); this.parent = parent; if (parent != null) { rootGroup = parent.rootGroup; } else { rootGroup = new SectionGroupInfo(); rootGroup.StreamName = streamName; } if (streamName != null) { Load(); } }
internal static void EnsureInit(IConfigMapPath configMapPath, bool listenToFileChanges, bool initComplete) { if (!s_inited) { lock (s_initLock) { if (!s_inited) { s_initComplete = initComplete; if (configMapPath == null) { configMapPath = IISMapPath.GetInstance(); } s_configMapPath = configMapPath; s_configSystem = (IConfigSystem)Activator.CreateInstance(Type.GetType("System.Configuration.Internal.ConfigSystem, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", true), true); object[] hostInitParams = new object[6]; hostInitParams[0] = true; hostInitParams[1] = s_configMapPath; hostInitParams[3] = HostingEnvironment.ApplicationVirtualPath; hostInitParams[4] = HostingEnvironment.SiteNameNoDemand; hostInitParams[5] = HostingEnvironment.SiteID; s_configSystem.Init(typeof(WebConfigurationHost), hostInitParams); s_configRoot = s_configSystem.Root; s_configHost = (WebConfigurationHost)s_configSystem.Host; HttpConfigurationSystem internalConfigSystem = new HttpConfigurationSystem(); if (listenToFileChanges) { s_configRoot.ConfigChanged += new InternalConfigEventHandler(internalConfigSystem.OnConfigurationChanged); } s_configSettingsFactory = (IInternalConfigSettingsFactory)Activator.CreateInstance(Type.GetType("System.Configuration.Internal.InternalConfigSettingsFactory, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", true), true); s_configSettingsFactory.SetConfigurationSystem(internalConfigSystem, initComplete); s_httpConfigSystem = internalConfigSystem; s_inited = true; } } } }
internal static void EnsureInit(IConfigMapPath configMapPath, bool listenToFileChanges, bool initComplete) { if (!s_inited) { lock (s_initLock) { if (!s_inited) { s_initComplete = initComplete; if (configMapPath == null) { configMapPath = IISMapPath.GetInstance(); } s_configMapPath = configMapPath; s_configSystem = (IConfigSystem) Activator.CreateInstance(Type.GetType("System.Configuration.Internal.ConfigSystem, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", true), true); object[] hostInitParams = new object[6]; hostInitParams[0] = true; hostInitParams[1] = s_configMapPath; hostInitParams[3] = HostingEnvironment.ApplicationVirtualPath; hostInitParams[4] = HostingEnvironment.SiteNameNoDemand; hostInitParams[5] = HostingEnvironment.SiteID; s_configSystem.Init(typeof(WebConfigurationHost), hostInitParams); s_configRoot = s_configSystem.Root; s_configHost = (WebConfigurationHost) s_configSystem.Host; HttpConfigurationSystem internalConfigSystem = new HttpConfigurationSystem(); if (listenToFileChanges) { s_configRoot.ConfigChanged += new InternalConfigEventHandler(internalConfigSystem.OnConfigurationChanged); } s_configSettingsFactory = (IInternalConfigSettingsFactory) Activator.CreateInstance(Type.GetType("System.Configuration.Internal.InternalConfigSettingsFactory, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", true), true); s_configSettingsFactory.SetConfigurationSystem(internalConfigSystem, initComplete); s_httpConfigSystem = internalConfigSystem; s_inited = true; } } } }
internal void Init(IConfigSystem system, string configPath, Configuration parent) { _system = system; _configPath = configPath; FileName = system.Host.GetStreamName(configPath); Parent = parent; if (parent != null) { _rootGroup = parent._rootGroup; } else { _rootGroup = new SectionGroupInfo { StreamName = FileName }; // Addd Machine.config sections foreach (var keyValuePair in MachineConfig.ConfigSections) { var sectionInfo = CreateSectionInfo(system, configPath, keyValuePair.Key, keyValuePair.Value); _rootGroup.AddChild(sectionInfo); } } try { if (FileName != null) { Load(); } } catch (XmlException ex) { throw new ConfigurationErrorsException(ex.Message, ex, FileName, 0); } }
// // Set this configuration system to the default for requests ConfigurationManager.GetSection // static internal void EnsureInit(IConfigMapPath configMapPath, bool listenToFileChanges, bool initComplete) { if (!s_inited) { lock (s_initLock) { if (!s_inited) { s_initComplete = initComplete; // Use the IIS map path if one is not explicitly provided if (configMapPath == null) { configMapPath = IISMapPath.GetInstance(); } s_configMapPath = configMapPath; Type typeConfigSystem = Type.GetType(ConfigSystemTypeString, true); s_configSystem = (IConfigSystem) Activator.CreateInstance(typeConfigSystem, true); s_configSystem.Init( typeof(WebConfigurationHost), // The config host we'll create and use // The remaining parameters are passed to the config host: true, // Use the supplied configMapPath s_configMapPath, // the configMapPath to use null, // ConfigurationFileMap HostingEnvironment.ApplicationVirtualPath, // app path HostingEnvironment.SiteNameNoDemand, // app site name HostingEnvironment.SiteID); // app site ID s_configRoot = s_configSystem.Root; s_configHost = (WebConfigurationHost) s_configSystem.Host; // Register for config changed notifications HttpConfigurationSystem configSystem = new HttpConfigurationSystem(); if (listenToFileChanges) { s_configRoot.ConfigChanged += new InternalConfigEventHandler(configSystem.OnConfigurationChanged); } // Set the configSystem into the ConfigurationManager class. // Please note that factory.SetConfigurationSystem will end up calling // ConfigurationManager.SetConfigurationSystem, which is an internal static method // in System.Configuration.dll. If we want to call that here, we have to use // reflection and that's what we want to avoid. Type typeFactory = Type.GetType(InternalConfigSettingsFactoryTypeString, true); s_configSettingsFactory = (IInternalConfigSettingsFactory) Activator.CreateInstance(typeFactory, true); s_configSettingsFactory.SetConfigurationSystem(configSystem, initComplete); // The system has been successfully set, so mark that we should use it. s_httpConfigSystem = configSystem; // Mark as having completed initialization after s_httpConfigSystem has been set. // s_inited is coordinated with s_httpConfigSystem in UseHttpConfigurationSystem. s_inited = true; } } } Debug.Assert(s_httpConfigSystem != null, "s_httpConfigSystem != null - The appdomain is using the client configuration system."); }
internal void Init (IConfigSystem system, string configPath, Configuration parent) { this.system = system; this.configPath = configPath; streamName = system.Host.GetStreamName (configPath); this.parent = parent; if (parent != null) rootGroup = parent.rootGroup; else { rootGroup = new SectionGroupInfo (); rootGroup.StreamName = streamName; } if (streamName != null) Load (); }
public NConfigSystemReplacement(IConfigSystem originalConfigSystem, IConfigurationFactory factory, IList<string> fileNames) { this.originalConfigSystem = originalConfigSystem; replacedRoot = new NConfigRootReplacement(originalConfigSystem.Root, factory, fileNames); }
public NConfigSystemReplacement(IConfigSystem originalConfigSystem, IConfigurationFactory factory, IList <string> fileNames) { this.originalConfigSystem = originalConfigSystem; replacedRoot = new NConfigRootReplacement(originalConfigSystem.Root, factory, fileNames); }
internal void Init (IConfigSystem system, string configPath, Configuration parent) { this.system = system; this.configPath = configPath; streamName = system.Host.GetStreamName (configPath); this.parent = parent; if (parent != null) rootGroup = parent.rootGroup; else { rootGroup = new SectionGroupInfo (); rootGroup.StreamName = streamName; } try { if (streamName != null) Load (); } catch (XmlException ex) { throw new ConfigurationErrorsException (ex.Message, ex, streamName, 0); } }
// // Set this configuration system to the default for requests ConfigurationManager.GetSection // static internal void EnsureInit(IConfigMapPath configMapPath, bool listenToFileChanges, bool initComplete) { if (!s_inited) { lock (s_initLock) { if (!s_inited) { s_initComplete = initComplete; // Use the IIS map path if one is not explicitly provided if (configMapPath == null) { configMapPath = IISMapPath.GetInstance(); } s_configMapPath = configMapPath; Type typeConfigSystem = Type.GetType(ConfigSystemTypeString, true); s_configSystem = (IConfigSystem)Activator.CreateInstance(typeConfigSystem, true); s_configSystem.Init( typeof(WebConfigurationHost), // The config host we'll create and use // The remaining parameters are passed to the config host: true, // Use the supplied configMapPath s_configMapPath, // the configMapPath to use null, // ConfigurationFileMap HostingEnvironment.ApplicationVirtualPath, // app path HostingEnvironment.SiteNameNoDemand, // app site name HostingEnvironment.SiteID); // app site ID s_configRoot = s_configSystem.Root; s_configHost = (WebConfigurationHost)s_configSystem.Host; // Register for config changed notifications HttpConfigurationSystem configSystem = new HttpConfigurationSystem(); if (listenToFileChanges) { s_configRoot.ConfigChanged += new InternalConfigEventHandler(configSystem.OnConfigurationChanged); } // Set the configSystem into the ConfigurationManager class. // Please note that factory.SetConfigurationSystem will end up calling // ConfigurationManager.SetConfigurationSystem, which is an internal static method // in System.Configuration.dll. If we want to call that here, we have to use // reflection and that's what we want to avoid. Type typeFactory = Type.GetType(InternalConfigSettingsFactoryTypeString, true); s_configSettingsFactory = (IInternalConfigSettingsFactory)Activator.CreateInstance(typeFactory, true); s_configSettingsFactory.SetConfigurationSystem(configSystem, initComplete); // The system has been successfully set, so mark that we should use it. s_httpConfigSystem = configSystem; // Mark as having completed initialization after s_httpConfigSystem has been set. // s_inited is coordinated with s_httpConfigSystem in UseHttpConfigurationSystem. s_inited = true; } } } Debug.Assert(s_httpConfigSystem != null, "s_httpConfigSystem != null - The appdomain is using the client configuration system."); }