Ejemplo n.º 1
0
        EnvironmentMergeData ReadEnvironmentMergeData(EnvironmentMergeSection environmentSection, IConfigurationUIHierarchy configurationHierarchy)
        {
            EnvironmentMergeData mergeData = new EnvironmentMergeData();

            foreach (EnvironmentNodeMergeElement mergeElement in environmentSection.MergeElements)
            {
                ConfigurationNodeMergeData propertyDictionaty = new ConfigurationNodeMergeData();
                foreach (string key in mergeElement.OverriddenProperties.AllKeys)
                {
                    string overriddenValue = mergeElement.OverriddenProperties[key].Value;
                    propertyDictionaty.SetPropertyValue(key, new UnserializedPropertyValue(overriddenValue));
                }
                ConfigurationNodeMergeData configurationNodeMergeData = new ConfigurationNodeMergeData(mergeElement.OverrideProperties, propertyDictionaty);
                string            fullNodePath = configurationHierarchy.RootNode.Path + mergeElement.ConfigurationNodePath;
                ConfigurationNode node         = configurationHierarchy.FindNodeByPath(fullNodePath);
                if (node != null)
                {
                    mergeData.UpdateMergeData(node, configurationNodeMergeData);
                }
            }

            return(mergeData);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Updates the <see cref="MergedConfigurationNode"/> for a specific <see cref="ConfigurationNode"/> instance.
 /// </summary>
 /// <param name="node">The <see cref="ConfigurationNode"/> whose properties in this environment should be updated.</param>
 /// <param name="value">The <see cref="MergedConfigurationNode"/> instance that contains all the differences for the <paramref name="node"/>.</param>
 public void SetOverrides(ConfigurationNode node, MergedConfigurationNode value)
 {
     environmentData.UpdateMergeData(node, value.MergeData);
 }