public override void GetObjectList(List <AppObject> objs, AppObject appobj, ConnectionPack connpack) { ObjectPath objpath = appobj.GetObjectPath(); IDatabaseSource conn = appobj.FindDatabaseConnection(connpack); if (conn != null && conn.Connection.IsOpened) { var dbmem = new DatabaseStructureMembers(); dbmem.IgnoreSystemObjects = true; if (_Type.ObjectType == "table") { dbmem.TableList = true; } else { var smem = new SpecificObjectMembers { ObjectList = true }; dbmem.SpecificObjectOverride[_Type.ObjectType] = smem; } var dbs = conn.InvokeLoadStructure(dbmem, null); if (_Type.ObjectType == "table") { foreach (var tbl in dbs.Tables) { var o = new TableAppObject(); o.FillFromDatabase(conn); o.DbObjectName = tbl.FullName; objs.Add(o); } } else { if (dbs.SpecificObjects.ContainsKey(_Type.ObjectType)) { foreach (var spec in dbs.SpecificObjects[_Type.ObjectType]) { var o = new SpecificObjectAppObject(); o.FillFromDatabase(conn); o.DbObjectName = spec.ObjectName; o.DbObjectType = _Type.ObjectType; objs.Add(o); } } } } objs.SortByKey(o => o.ToString()); }
public void LoadFromXml_ForJob(XmlElement xml) { if (xml.GetAttribute("table") == "1") { TableMembers = TableStructureMembers.AllNoRefs; } if (xml.SelectSingleNode("Table") != null) { TableFilter = new List <NameWithSchema>(); } foreach (XmlElement x in xml.SelectNodes("Table")) { TableFilter.Add(NameWithSchema.LoadFromXml(x)); } foreach (XmlAttribute attr in xml.Attributes) { if (!attr.Name.StartsWith("detail.")) { continue; } string type = attr.Name.Substring("detail.".Length); SpecificObjectOverride[type] = new SpecificObjectMembers(); SpecificObjectOverride[type].ObjectDetail = true; } foreach (XmlElement child in xml) { if (child.Name == "Table") { continue; } var repr = SpecificRepresentationAddonType.Instance.FindByElement(child.Name); if (repr == null) { continue; } if (SpecificObjectOverride[repr.ObjectType] == null) { SpecificObjectOverride[repr.ObjectType] = new SpecificObjectMembers(); } if (SpecificObjectOverride[repr.ObjectType].ObjectFilter == null) { SpecificObjectOverride[repr.ObjectType].ObjectFilter = new List <NameWithSchema>(); } SpecificObjectOverride[repr.ObjectType].ObjectFilter.Add(NameWithSchema.LoadFromXml(child)); } this.LoadPropertiesCore(xml); }
public void GetMembers(DatabaseStructureMembers dbmem) { if (RealNode.NodeChecked) { var mem = new SpecificObjectMembers(); dbmem.SpecificObjectOverride[m_repr.ObjectType] = mem; mem.ObjectDetail = true; mem.ObjectList = true; if (!RealNode.CheckedAllChildren()) { mem.ObjectFilter = new List <NameWithSchema>(); foreach (var child in RealNode.RealChildren) { if (child.NodeChecked) { mem.ObjectFilter.Add(((DbDefChooseSpecObjectTreeNode)child.LogicalNode).m_obj.ObjectName); } } } } }