当前位置: 首页>>代码示例>>C#>>正文


C# ConfigurationElement.PropertyInfoInternal方法代码示例

本文整理汇总了C#中System.Configuration.ConfigurationElement.PropertyInfoInternal方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationElement.PropertyInfoInternal方法的具体用法?C# ConfigurationElement.PropertyInfoInternal怎么用?C# ConfigurationElement.PropertyInfoInternal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Configuration.ConfigurationElement的用法示例。


在下文中一共展示了ConfigurationElement.PropertyInfoInternal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleLockedAttributes

        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;
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:41,代码来源:configurationelement.cs

示例2: HandleLockedAttributes

 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;
                 }
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:ConfigurationElement.cs

示例3: HandleLockedAttributes

 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;
     }
       }
 }
开发者ID:wcpro,项目名称:iEnvoke,代码行数:25,代码来源:ConfigurationElement.cs


注:本文中的System.Configuration.ConfigurationElement.PropertyInfoInternal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。