public DatabaseStructure(XmlElement xml) : base(xml) { Initialize(); if (xml.HasAttribute("dialect")) { Dialect = (ISqlDialect)XmlTool.ValueFromString(typeof(ISqlDialect), xml.GetAttribute("dialect")); } if (xml.HasAttribute("singleschema")) { ForceSingleSchema = xml.GetAttribute("singleschema") == "1"; } foreach (XmlElement child in xml) { switch (child.Name) { case "Table": Tables.Add(new TableStructure(child)); break; case "Specific": AddSpecificObject(new SpecificObjectStructure(child, child.GetAttribute("objtype")), true); break; case "Schema": Schemata.Add(new SchemaStructure(child)); break; case "Domain": Domains.Add(new DomainStructure(child)); break; case "Collation": Collations.Add(new CollationStructure(child)); break; case "CharacterSet": CharacterSets.Add(new CharacterSetStructure(child)); break; default: { ISpecificRepresentation repr = SpecificRepresentationAddonType.Instance.FindByElement(child.Name); if (repr == null) { throw new Exception("DAE-00243 Unexpected element:" + child.Name); } AddSpecificObject(new SpecificObjectStructure(child, repr.ObjectType), true); } break; } } }
public static void LoadSettingsPage(SettingsPageBase page, XmlElement xml) { foreach (PropertyInfo prop in page.GetType().GetProperties()) { foreach (SettingsKeyAttribute attr in prop.GetCustomAttributes(typeof(SettingsKeyAttribute), true)) { XmlElement node = xml.SelectSingleNode(String.Format("Param[@name=\"{0}\"]", attr.KeyName)) as XmlElement; if (node != null) { object value = XmlTool.ValueFromString(prop.PropertyType, node.GetAttribute("value")); prop.CallSet(page, value); } } } }