internal void MergeWith(List <TServiceModelExtensionElement> parentExtensionElements)
        {
            ServiceModelExtensionCollectionElement <TServiceModelExtensionElement> .Merge(parentExtensionElements, this);

            this.Clear();
            foreach (TServiceModelExtensionElement parentExtensionElement in parentExtensionElements)
            {
                this.Add(parentExtensionElement);
            }
        }
        protected override void Unmerge(ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
        {
            if (sourceElement == null)
            {
                return;
            }

            ServiceModelExtensionCollectionElement <TServiceModelExtensionElement> sourceCollectionElement = (ServiceModelExtensionCollectionElement <TServiceModelExtensionElement>)sourceElement;

            this.UpdateProperties(sourceCollectionElement);
            base.Unmerge(sourceElement, parentElement, saveMode);
        }
        protected override void Reset(ConfigurationElement parentElement)
        {
            ServiceModelExtensionCollectionElement <TServiceModelExtensionElement> sourceElement = (ServiceModelExtensionCollectionElement <TServiceModelExtensionElement>)parentElement;

            foreach (TServiceModelExtensionElement local in sourceElement.Items)
            {
                this.Items.Add(local);
            }
            this.UpdateProperties(sourceElement);
            this.contextHelper.OnReset(parentElement);
            base.Reset(parentElement);
        }
        protected override void Reset(ConfigurationElement parentElement)
        {
            ServiceModelExtensionCollectionElement <TServiceModelExtensionElement> collection =
                (ServiceModelExtensionCollectionElement <TServiceModelExtensionElement>)parentElement;

            foreach (TServiceModelExtensionElement collectionElement in collection.Items)
            {
                this.Items.Add(collectionElement);
            }
            // Update my properties
            this.UpdateProperties(collection);

            this.contextHelper.OnReset(parentElement);

            base.Reset(parentElement);
        }
 private void UpdateProperties(ServiceModelExtensionCollectionElement <TServiceModelExtensionElement> sourceElement)
 {
     foreach (ConfigurationProperty property in sourceElement.Properties)
     {
         if (!this.Properties.Contains(property.Name))
         {
             this.Properties.Add(property);
         }
     }
     foreach (TServiceModelExtensionElement local in this.Items)
     {
         if (!(local is ClearBehaviorElement) && !(local is RemoveBehaviorElement))
         {
             string configurationElementName = local.ConfigurationElementName;
             if (!this.Properties.Contains(configurationElementName))
             {
                 ConfigurationProperty property2 = new ConfigurationProperty(configurationElementName, local.GetType(), null);
                 this.Properties.Add(property2);
             }
         }
     }
 }
        void UpdateProperties(ServiceModelExtensionCollectionElement <TServiceModelExtensionElement> sourceElement)
        {
            foreach (ConfigurationProperty property in sourceElement.Properties)
            {
                if (!this.Properties.Contains(property.Name))
                {
                    this.Properties.Add(property);
                }
            }
            foreach (TServiceModelExtensionElement extension in this.Items)
            {
                if (extension is ClearBehaviorElement || extension is RemoveBehaviorElement)
                {
                    continue;
                }

                string configuredSectionName = extension.ConfigurationElementName;
                if (!this.Properties.Contains(configuredSectionName))
                {
                    ConfigurationProperty configProperty = new ConfigurationProperty(configuredSectionName, extension.GetType(), null);
                    this.Properties.Add(configProperty);
                }
            }
        }