internal Configuration(string locationSubPath, Type typeConfigHost, params object[] hostInitConfigurationParams) { string str; string str2; this._typeConfigHost = typeConfigHost; this._hostInitConfigurationParams = hostInitConfigurationParams; this._configRoot = new InternalConfigRoot(this); IInternalConfigHost host = (IInternalConfigHost)System.Configuration.TypeUtil.CreateInstanceWithReflectionPermission(typeConfigHost); IInternalConfigHost host2 = new UpdateConfigHost(host); ((IInternalConfigRoot)this._configRoot).Init(host2, true); host.InitForConfiguration(ref locationSubPath, out str, out str2, this._configRoot, hostInitConfigurationParams); if (!string.IsNullOrEmpty(locationSubPath) && !host2.SupportsLocation) { throw ExceptionUtil.UnexpectedError("Configuration::ctor"); } if (string.IsNullOrEmpty(locationSubPath) != string.IsNullOrEmpty(str2)) { throw ExceptionUtil.UnexpectedError("Configuration::ctor"); } this._configRecord = (MgmtConfigurationRecord)this._configRoot.GetConfigRecord(str); if (!string.IsNullOrEmpty(locationSubPath)) { this._configRecord = MgmtConfigurationRecord.Create(this._configRoot, this._configRecord, str2, locationSubPath); } this._configRecord.ThrowIfInitErrors(); }
internal Configuration(string locationSubPath, Type typeConfigHost, params object[] hostInitConfigurationParams) { _typeConfigHost = typeConfigHost; _hostInitConfigurationParams = hostInitConfigurationParams; IInternalConfigHost configHost = (IInternalConfigHost)TypeUtil.CreateInstance(typeConfigHost); // Wrap the host with the UpdateConfigHost to support SaveAs. UpdateConfigHost updateConfigHost = new UpdateConfigHost(configHost); // Now wrap in ImplicitMachineConfigHost so we can stub in a simple machine.config if needed. IInternalConfigHost implicitMachineConfigHost = new ImplicitMachineConfigHost(updateConfigHost); InternalConfigRoot configRoot = new InternalConfigRoot(this, updateConfigHost); ((IInternalConfigRoot)configRoot).Init(implicitMachineConfigHost, isDesignTime: true); // Set the configuration paths for this Configuration. // // We do this in a separate step so that the WebConfigurationHost // can use this object's _configRoot to get the <sites> section, // which is used in it's MapPath implementation. string configPath, locationConfigPath; implicitMachineConfigHost.InitForConfiguration( ref locationSubPath, out configPath, out locationConfigPath, configRoot, hostInitConfigurationParams); if (!string.IsNullOrEmpty(locationSubPath) && !implicitMachineConfigHost.SupportsLocation) { throw ExceptionUtil.UnexpectedError("Configuration::ctor"); } if (string.IsNullOrEmpty(locationSubPath) != string.IsNullOrEmpty(locationConfigPath)) { throw ExceptionUtil.UnexpectedError("Configuration::ctor"); } // Get the configuration record for this config file. _configRecord = (MgmtConfigurationRecord)configRoot.GetConfigRecord(configPath); // Create another MgmtConfigurationRecord for the location that is a child of the above record. // Note that this does not match the resolution hiearchy that is used at runtime. if (!string.IsNullOrEmpty(locationSubPath)) { _configRecord = MgmtConfigurationRecord.Create( configRoot, _configRecord, locationConfigPath, locationSubPath); } // Throw if the config record we created contains global errors. _configRecord.ThrowIfInitErrors(); }
private ContextInformation _evalContext; // evaluation context internal Configuration(string locationSubPath, Type typeConfigHost, params object[] hostInitConfigurationParams) { _typeConfigHost = typeConfigHost; _hostInitConfigurationParams = hostInitConfigurationParams; _configRoot = new InternalConfigRoot(); IInternalConfigHost configHost = (IInternalConfigHost)TypeUtil.CreateInstanceWithReflectionPermission(typeConfigHost); // Wrap the host with the UpdateConfigHost to support SaveAs. IInternalConfigHost updateConfigHost = new UpdateConfigHost(configHost); _configRoot.Init(updateConfigHost, true); // // Set the configuration paths for this Configuration. // We do this in a separate step so that the WebConfigurationHost // can use this object's _configRoot to get the <sites> section, // which is used in it's MapPath implementation. // string configPath, locationConfigPath; configHost.InitForConfiguration(ref locationSubPath, out configPath, out locationConfigPath, _configRoot, hostInitConfigurationParams); if (!String.IsNullOrEmpty(locationSubPath) && !updateConfigHost.SupportsLocation) { throw ExceptionUtil.UnexpectedError("Configuration::ctor"); } if (String.IsNullOrEmpty(locationSubPath) != String.IsNullOrEmpty(locationConfigPath)) { throw ExceptionUtil.UnexpectedError("Configuration::ctor"); } // Get the configuration record for this config file. _configRecord = (MgmtConfigurationRecord)_configRoot.GetConfigRecord(configPath); // // Create another MgmtConfigurationRecord for the location that is a child of the above record. // Note that this does not match the resolution hiearchy that is used at runtime. // if (!String.IsNullOrEmpty(locationSubPath)) { _configRecord = MgmtConfigurationRecord.Create( _configRoot, _configRecord, locationConfigPath, locationSubPath); } // // Throw if the config record we created contains global errors. // _configRecord.ThrowIfInitErrors(); }
internal Configuration(string locationSubPath, Type typeConfigHost, params object[] hostInitConfigurationParams) { _typeConfigHost = typeConfigHost; _hostInitConfigurationParams = hostInitConfigurationParams; _configRoot = new InternalConfigRoot(this); IInternalConfigHost configHost = (IInternalConfigHost)TypeUtil.CreateInstanceWithReflectionPermission(typeConfigHost); // Wrap the host with the UpdateConfigHost to support SaveAs. IInternalConfigHost updateConfigHost = new UpdateConfigHost(configHost); ((IInternalConfigRoot)_configRoot).Init(updateConfigHost, true); // // Set the configuration paths for this Configuration. // We do this in a separate step so that the WebConfigurationHost // can use this object's _configRoot to get the <sites> section, // which is used in it's MapPath implementation. // string configPath, locationConfigPath; configHost.InitForConfiguration(ref locationSubPath, out configPath, out locationConfigPath, _configRoot, hostInitConfigurationParams); if (!String.IsNullOrEmpty(locationSubPath) && !updateConfigHost.SupportsLocation) { throw ExceptionUtil.UnexpectedError("Configuration::ctor"); } if (String.IsNullOrEmpty(locationSubPath) != String.IsNullOrEmpty(locationConfigPath)) { throw ExceptionUtil.UnexpectedError("Configuration::ctor"); } // Get the configuration record for this config file. _configRecord = (MgmtConfigurationRecord)_configRoot.GetConfigRecord(configPath); // // Create another MgmtConfigurationRecord for the location that is a child of the above record. // Note that this does not match the resolution hiearchy that is used at runtime. // if (!String.IsNullOrEmpty(locationSubPath)) { _configRecord = MgmtConfigurationRecord.Create( _configRoot, _configRecord, locationConfigPath, locationSubPath); } // // Throw if the config record we created contains global errors. // _configRecord.ThrowIfInitErrors(); }
internal Configuration(string locationSubPath, Type typeConfigHost, params object[] hostInitConfigurationParams) { _typeConfigHost = typeConfigHost; _hostInitConfigurationParams = hostInitConfigurationParams; IInternalConfigHost configHost = (IInternalConfigHost)TypeUtil.CreateInstance(typeConfigHost); // Wrap the host with the UpdateConfigHost to support SaveAs. UpdateConfigHost updateConfigHost = new UpdateConfigHost(configHost); // Now wrap in ImplicitMachineConfigHost so we can stub in a simple machine.config if needed. IInternalConfigHost implicitMachineConfigHost = new ImplicitMachineConfigHost(updateConfigHost); InternalConfigRoot configRoot = new InternalConfigRoot(this, updateConfigHost); ((IInternalConfigRoot)configRoot).Init(implicitMachineConfigHost, isDesignTime: true); // Set the configuration paths for this Configuration. // // We do this in a separate step so that the WebConfigurationHost // can use this object's _configRoot to get the <sites> section, // which is used in it's MapPath implementation. string configPath, locationConfigPath; implicitMachineConfigHost.InitForConfiguration( ref locationSubPath, out configPath, out locationConfigPath, configRoot, hostInitConfigurationParams); if (!string.IsNullOrEmpty(locationSubPath) && !implicitMachineConfigHost.SupportsLocation) throw ExceptionUtil.UnexpectedError("Configuration::ctor"); if (string.IsNullOrEmpty(locationSubPath) != string.IsNullOrEmpty(locationConfigPath)) throw ExceptionUtil.UnexpectedError("Configuration::ctor"); // Get the configuration record for this config file. _configRecord = (MgmtConfigurationRecord)configRoot.GetConfigRecord(configPath); // Create another MgmtConfigurationRecord for the location that is a child of the above record. // Note that this does not match the resolution hiearchy that is used at runtime. if (!string.IsNullOrEmpty(locationSubPath)) { _configRecord = MgmtConfigurationRecord.Create( configRoot, _configRecord, locationConfigPath, locationSubPath); } // Throw if the config record we created contains global errors. _configRecord.ThrowIfInitErrors(); }
internal ImplicitMachineConfigHost(UpdateConfigHost host) { // Delegate to the host provided. Host = host; }