示例#1
0
        /// <summary>
        /// Instantiates a <see cref="AssemblyConfiguration"/>
        /// </summary>
        public AssemblyConfiguration(string xml)
        {
            // load xml
            var xmlDocument = new XmlDocument();
            xmlDocument.LoadXml(xml);

            // validate first child
            xmlDocument.FirstChild.ShouldBeNamed(RootName);

            // get different sections
            foreach (var childNode in xmlDocument.FirstChild.ChildNodes.OfType<XmlElement>())
            {
                switch (childNode.Name)
                {
                    case AssemblyConfigurationSettings.SettingsCollectionName:
                        _settings = new AssemblyConfigurationSettings(childNode);
                        break;
                    case AssemblyConfigurationRegistrations.RegistrationsCollectionName:
                        _registrations = new AssemblyConfigurationRegistrations(childNode);
                        break;
                    default:
                        _customSections.Add(CreateCustomSection(childNode));
                        break;
                }
            }
        }
示例#2
0
        /// <summary>
        /// Instantiates a <see cref="AssemblyConfiguration"/>
        /// </summary>
        public AssemblyConfiguration(string xml)
        {
            // load xml
            var xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(xml);

            // validate first child
            xmlDocument.FirstChild.ShouldBeNamed(RootName);

            // get different sections
            foreach (var childNode in xmlDocument.FirstChild.ChildNodes.OfType <XmlElement>())
            {
                switch (childNode.Name)
                {
                case AssemblyConfigurationSettings.SettingsCollectionName:
                    _settings = new AssemblyConfigurationSettings(childNode);
                    break;

                case AssemblyConfigurationRegistrations.RegistrationsCollectionName:
                    _registrations = new AssemblyConfigurationRegistrations(childNode);
                    break;

                default:
                    _customSections.Add(CreateCustomSection(childNode));
                    break;
                }
            }
        }