Inheritance: BaseConfigurationRecord
        private HybridDictionary _streamInfoUpdates; // List of StreamInfo, including the main config file, the configSource this record uses, and
                                                    // new configSource stream added thru API


        static internal MgmtConfigurationRecord Create(
                IInternalConfigRoot         configRoot,
                IInternalConfigRecord       parent,
                string                      configPath,
                string                      locationSubPath) {

            MgmtConfigurationRecord configRecord = new MgmtConfigurationRecord();
            configRecord.Init(configRoot, parent, configPath, locationSubPath);
            return configRecord;
        }
        internal void DetachFromConfigurationRecord() {
            if (_configSections != null) {
                _configSections.DetachFromConfigurationRecord();
            }

            if (_configSectionGroups != null) {
                _configSectionGroups.DetachFromConfigurationRecord();
            }

            _configRecord = null;
        }
        //
        // Create the collection of all section groups in the section group.
        //
        internal ConfigurationSectionGroupCollection(MgmtConfigurationRecord configRecord, ConfigurationSectionGroup configSectionGroup) :
                base(StringComparer.Ordinal) {
            _configRecord = configRecord;
            _configSectionGroup = configSectionGroup;

            foreach (DictionaryEntry de in _configRecord.SectionGroupFactories) {
                FactoryId factoryId = (FactoryId) de.Value;
                if (factoryId.Group == _configSectionGroup.SectionGroupName) {
                    BaseAdd(factoryId.Name, factoryId.Name);
                }
            }
        }
 internal ConfigurationSectionCollection(MgmtConfigurationRecord configRecord, ConfigurationSectionGroup configSectionGroup) : base(StringComparer.Ordinal)
 {
     this._configRecord = configRecord;
     this._configSectionGroup = configSectionGroup;
     foreach (DictionaryEntry entry in this._configRecord.SectionFactories)
     {
         FactoryId id = (FactoryId) entry.Value;
         if (id.Group == this._configSectionGroup.SectionGroupName)
         {
             base.BaseAdd(id.Name, id.Name);
         }
     }
 }
        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();
        }
Esempio n. 6
0
        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 void AttachToConfigurationRecord(MgmtConfigurationRecord configRecord, FactoryRecord factoryRecord) {
            _configRecord = configRecord;
            _configKey = factoryRecord.ConfigKey;
            _group = factoryRecord.Group;
            _name = factoryRecord.Name;
            _typeName = factoryRecord.FactoryTypeName;

            if (_typeName != null) {
                 FactoryRecord parentFactoryRecord = null;
                 if (!configRecord.Parent.IsRootConfig) {
                     parentFactoryRecord = configRecord.Parent.FindFactoryRecord(factoryRecord.ConfigKey, true);
                 }

                 _declarationRequired = (parentFactoryRecord == null || parentFactoryRecord.FactoryTypeName == null);
                 _declared            = configRecord.GetFactoryRecord(factoryRecord.ConfigKey, true) != null;
            }
        }
 internal void AttachToConfigurationRecord(MgmtConfigurationRecord configRecord, FactoryRecord factoryRecord)
 {
     this._configRecord = configRecord;
     this._configKey = factoryRecord.ConfigKey;
     this._group = factoryRecord.Group;
     this._name = factoryRecord.Name;
     this._typeName = factoryRecord.FactoryTypeName;
     if (this._typeName != null)
     {
         FactoryRecord record = null;
         if (!configRecord.Parent.IsRootConfig)
         {
             record = configRecord.Parent.FindFactoryRecord(factoryRecord.ConfigKey, true);
         }
         this._declarationRequired = (record == null) || (record.FactoryTypeName == null);
         this._declared = configRecord.GetFactoryRecord(factoryRecord.ConfigKey, true) != null;
     }
 }
 internal void DetachFromConfigurationRecord()
 {
     this.RevertToParent();
     this._flags[1] = false;
     this._configRecord = null;
 }
 internal void AttachToConfigurationRecord(MgmtConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord)
 {
     this.SetRuntimeConfigurationInformation(configRecord, factoryRecord, sectionRecord);
     this._configRecord = configRecord;
 }
        internal void RootAttachToConfigurationRecord(MgmtConfigurationRecord configRecord)
        {
            _configRecord = configRecord;

            _isRoot = true;
        }
 internal void DetachFromConfigurationRecord() {
     RevertToParent();
     _flags[ Flag_Attached ] = false;
     _configRecord = null;
 }
 //
 // Remove the collection from configuration system, and remove all entries
 // in the base collection so that enumeration will return an empty collection.
 //
 internal void DetachFromConfigurationRecord() {
     _configRecord = null;
     BaseClear();
 }
 internal void DetachFromConfigurationRecord()
 {
     this._configRecord = null;
     base.BaseClear();
 }