Source/NFX/Environment/ConfigNode.cs
/// <summary>
/// Merges another node data by overriding this node's value/attributes/sub nodes according to rules.
/// </summary>
/// <returns>True when merge match was made</returns>
Merges another node data by overriding this node's value/attributes/sub nodes according to rules.
Merges another node data by overriding this node ' s value / attributes / sub nodes according to rules .
public bool OverrideBy(IConfigSectionNode other, NodeOverrideRules rules = null)
        {
          if (other==null) return false;
          checkCanModify();
          if (rules==null) rules = NodeOverrideRules.Default;
          if (!IsSameName(other)) return false;
          var ospec = rules.StringToOverrideSpec(this.AttrByName(rules.OverrideAttrName).Value);
          switch(ospec)
          {
            case OverrideSpec.Stop: return false;
            case OverrideSpec.All:
                                         if (other[rules.SectionDeleteName].Exists) { this.Delete(); return true; }
                                         MergeAttributes(other, rules);
                                         MergeSections(other, rules);
                                         Value = other.VerbatimValue;
                                         break;
            case OverrideSpec.Attributes:
                                         MergeAttributes(other, rules);
                                         break;
            case OverrideSpec.Sections:
                                         MergeSections(other, rules);
                                         break;
            case OverrideSpec.Replace:
                                         ReplaceBy(other);
                                         break;
            default: 
              throw new ConfigException(StringConsts.CONFIGURATION_OVERRIDE_PROHOBITED_ERROR + this.RootPath);
          }
          return true;
        }
public bool OverrideBy ( IConfigSectionNode other , NodeOverrideRules rules = null ) { if ( other == null ) return false ; checkCanModify ( ) ; if ( rules == null ) rules = NodeOverrideRules . Default ; if ( ! IsSameName ( other ) ) return false ; var ospec = rules . StringToOverrideSpec ( this . AttrByName ( rules . OverrideAttrName ) . Value ) ; switch ( ospec ) { case OverrideSpec . Stop : return false ; case OverrideSpec . All : if ( other [ rules . SectionDeleteName ] . Exists ) { this . Delete ( ) ; return true ; } MergeAttributes ( other , rules ) ; MergeSections ( other , rules ) ; Value = other . VerbatimValue ; break ; case OverrideSpec . Attributes : MergeAttributes ( other , rules ) ; break ; case OverrideSpec . Sections : MergeSections ( other , rules ) ; break ; case OverrideSpec . Replace : ReplaceBy ( other ) ; break ; default : throw new ConfigException ( StringConsts . CONFIGURATION_OVERRIDE_PROHOBITED_ERROR + this . RootPath ) ; } return true ; }
Merges another node data by overriding this node's value/attributes/sub nodes according to rules.
Merges another node data by overriding this node ' s value / attributes / sub nodes according to rules .
//fail
True when merge match was made
True when merge match was made
other
IConfigSectionNode
rules
NodeOverrideRules