PropertyInfoInternal() private method

private PropertyInfoInternal ( string propertyName ) : PropertySourceInfo
propertyName string
return PropertySourceInfo
 internal void HandleLockedAttributes(ConfigurationElement source)
 {
     if ((source != null) && ((source._lockedAttributesList != null) || (source._lockedAllExceptAttributesList != null)))
     {
         foreach (PropertyInformation information in source.ElementInformation.Properties)
         {
             if ((((source._lockedAttributesList != null) && (source._lockedAttributesList.Contains(information.Name) || source._lockedAttributesList.Contains("*"))) || ((source._lockedAllExceptAttributesList != null) && !source._lockedAllExceptAttributesList.Contains(information.Name))) && ((information.Name != "lockAttributes") && (information.Name != "lockAllAttributesExcept")))
             {
                 if (this.ElementInformation.Properties[information.Name] == null)
                 {
                     ConfigurationPropertyCollection properties = this.Properties;
                     ConfigurationProperty property = source.Properties[information.Name];
                     properties.Add(property);
                     this._evaluationElement = null;
                     ConfigurationValueFlags valueFlags = ConfigurationValueFlags.Locked | ConfigurationValueFlags.Inherited;
                     this._values.SetValue(information.Name, information.Value, valueFlags, source.PropertyInfoInternal(information.Name));
                 }
                 else
                 {
                     if (this.ElementInformation.Properties[information.Name].ValueOrigin == PropertyValueOrigin.SetHere)
                     {
                         throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_base_attribute_locked", new object[] { information.Name }));
                     }
                     this.ElementInformation.Properties[information.Name].Value = information.Value;
                 }
             }
         }
     }
 }
 // Internal method to fix SetRawXML defect...
 internal PropertySourceInfo PropertyInfoInternal()
 {
     return(_thisElement.PropertyInfoInternal(_thisElement.ElementTagName));
 }
        internal void HandleLockedAttributes(ConfigurationElement source) {
            // if there are locked attributes on this collection element
            if (source != null) {
                if (source._lockedAttributesList != null || source._lockedAllExceptAttributesList != null) {
                    // enumerate the possible locked properties
                    foreach (PropertyInformation propInfo in source.ElementInformation.Properties) {
                        if ((source._lockedAttributesList != null && (source._lockedAttributesList.Contains(propInfo.Name) ||
                            source._lockedAttributesList.Contains(LockAll))) ||
                            (source._lockedAllExceptAttributesList != null && !source._lockedAllExceptAttributesList.Contains(propInfo.Name))
                           ) {
                            // if the attribute has been locked in the source then check to see
                            // if the local config is trying to override it
                            if (propInfo.Name != LockAttributesKey && propInfo.Name != LockAllAttributesExceptKey) {

                                if (ElementInformation.Properties[propInfo.Name] == null) { // locked items are not defined
                                    
                                    ConfigurationPropertyCollection props = Properties; // so create the property based in the source item
                                    ConfigurationProperty prop = (ConfigurationProperty)source.Properties[propInfo.Name];
                                    props.Add(prop); // Add the property information to the property bag
                                    _evaluationElement = null; // flush the cached element data

                                    // Add the data from the source element but mark it as in herited
                                    // This must use setvalue in order to set the lock and inherited flags
                                    ConfigurationValueFlags flags = ConfigurationValueFlags.Inherited | ConfigurationValueFlags.Locked;
                                    _values.SetValue(propInfo.Name, propInfo.Value, flags, source.PropertyInfoInternal(propInfo.Name));

                                }
                                else { // don't error when optional attibute are not defined yet
                                    if (ElementInformation.Properties[propInfo.Name].ValueOrigin == PropertyValueOrigin.SetHere) {
                                        // Don't allow the override
                                        throw new ConfigurationErrorsException(SR.GetString(SR.Config_base_attribute_locked, propInfo.Name));
                                    }
                                    // They did not override so we need to make sure the value comes from the locked one
                                    ElementInformation.Properties[propInfo.Name].Value = propInfo.Value;
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #4
0
 internal void HandleLockedAttributes(ConfigurationElement source)
 {
     if (source == null || source._lockedAttributesList == null && source._lockedAllExceptAttributesList == null)
     return;
       foreach (PropertyInformation propertyInformation in (NameObjectCollectionBase) source.ElementInformation.Properties)
       {
     if ((source._lockedAttributesList != null && (source._lockedAttributesList.Contains(propertyInformation.Name) || source._lockedAttributesList.Contains("*")) || source._lockedAllExceptAttributesList != null && !source._lockedAllExceptAttributesList.Contains(propertyInformation.Name)) && (propertyInformation.Name != "lockAttributes" && propertyInformation.Name != "lockAllAttributesExcept"))
     {
       if (this.ElementInformation.Properties[propertyInformation.Name] == null)
       {
     this.Properties.Add(source.Properties[propertyInformation.Name]);
     this._evaluationElement = (ElementInformation) null;
     ConfigurationValueFlags valueFlags = ConfigurationValueFlags.Inherited | ConfigurationValueFlags.Locked;
     this._values.SetValue(propertyInformation.Name, propertyInformation.Value, valueFlags, source.PropertyInfoInternal(propertyInformation.Name));
       }
       else if (this.ElementInformation.Properties[propertyInformation.Name].ValueOrigin == PropertyValueOrigin.SetHere)
     throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_base_attribute_locked", new object[1]
     {
       (object) propertyInformation.Name
     }));
       else
     this.ElementInformation.Properties[propertyInformation.Name].Value = propertyInformation.Value;
     }
       }
 }