public void Save(XmlElement xml) { if (Dialect != null) { xml.SetAttribute("dialect", XmlTool.ValueToString(typeof(ISqlDialect), Dialect)); } if (ForceSingleSchema) { xml.SetAttribute("singleschema", "1"); } SaveBase(xml); foreach (TableStructure table in Tables) { XmlElement tx = XmlTool.AddChild(xml, "Table"); table.Save(tx); } foreach (string objtype in SpecificObjects.Keys) { ISpecificRepresentation repr = SpecificRepresentationAddonType.Instance.FindRepresentation(objtype); foreach (SpecificObjectStructure obj in SpecificObjects[objtype]) { XmlElement tx = XmlTool.AddChild(xml, repr.XmlElementName ?? "Specific"); if (repr.XmlElementName == null) { tx.SetAttribute("objtype", objtype); } obj.Save(tx); } } foreach (DomainStructure dom in Domains) { XmlElement dx = XmlTool.AddChild(xml, "Domain"); dom.Save(dx); } }
public static void SaveSettingsPage(SettingsPageBase page, SettingsPageBase pageBase, XmlElement xml) { foreach (PropertyInfo prop in page.GetType().GetProperties()) { foreach (SettingsKeyAttribute attr in prop.GetCustomAttributes(typeof(SettingsKeyAttribute), true)) { object myvalue = prop.CallGet(page), baseValue = null; if (pageBase != null) { baseValue = prop.CallGet(pageBase); } if (myvalue != null && (baseValue == null || !myvalue.Equals(baseValue))) { XmlElement parx = xml.AddChild("Param"); parx.SetAttribute("name", attr.KeyName); parx.SetAttribute("value", XmlTool.ValueToString(prop.PropertyType, myvalue)); } } } }