public DbDefChooseSpecObjectTreeNode(DbDefChooseSpecObjectsTreeNode parent, ISpecificObjectStructure obj) : base(parent, obj.ObjectName.ToString()) { m_repr = SpecificRepresentationAddonType.Instance.FindRepresentation(obj.ObjectType); m_obj = obj; m_db = parent.m_db; }
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 DbDefChooseSpecObjectsTreeNode(DbDefChooseTreeNode parent, string objtype) : base(parent, objtype + "_list") { m_repr = SpecificRepresentationAddonType.Instance.FindRepresentation(objtype); m_objtype = objtype; m_db = parent.m_db; }
private void WantInfo() { if (m_anyObject != null) { return; } if (GroupId == null) { return; } m_srcObject = m_diff.FindSource(GroupId); m_dstObject = m_diff.FindTarget(GroupId); m_anyObject = m_srcObject ?? m_dstObject; Errors.CheckNotNull("DAE-00364", m_anyObject); m_srcName = m_srcObject != null?m_srcObject.GetName() : null; m_dstName = m_dstObject != null?m_dstObject.GetName() : null; var name = m_anyObject.GetName(); m_repr = SpecificRepresentationAddonType.Instance.TryFindRepresentation(name.ObjectType); if (m_repr != null) { m_typeImage = m_repr.Icon; } if (m_typeImage == null && name != null) { m_typeImage = Constraint.GetTypeBitmap(name.ObjectType); } if (m_typeImage == null && m_anyObject is IColumnStructure) { m_typeImage = CoreIcons.column; } }
public SpecificObjectsNode(IDatabaseSource conn, ITreeNode parent, ISpecificObjectType dbtype, ISpecificRepresentation repr, ObjectPath parpath, bool isSystem) : base(conn, parent, Texts.GetTextIdWithoutPrefix(repr.TitlePlural)) { m_conn = conn; m_dbtype = dbtype; m_repr = repr; m_parpath = parpath; m_isSystem = isSystem; }
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 SpecificObjectFrame(IDatabaseSource conn, string objtype, string initsql, ObjectEditorPars pars) { InitializeComponent(); m_conn = conn; m_objtype = objtype; m_pars = pars; m_repr = SpecificRepresentationAddonType.Instance.FindRepresentation(m_objtype); if (initsql != null) { codeEditor1.Text = initsql; } }
//ISpecificObjectStructure m_struct; public SpecificObjectNode(SpecificObjectsNode parent, IDatabaseSource conn, ISpecificObjectType dbtype, ISpecificRepresentation repr, ObjectPath objpath) : base(new ConnectionWrapperUsage(parent.GetConnection()), parent, objpath.ObjectName.ToString()) { m_dbtype = dbtype; m_repr = repr; m_objpath = objpath; m_conn = conn; m_objCaps = m_conn.AlterCaps[m_dbtype.ObjectType]; var appobj = new SpecificObjectAppObject(); appobj.FillFromDatabase(conn); appobj.DbObjectName = m_objpath.ObjectName; appobj.DbObjectType = dbtype.ObjectType; SetAppObject(appobj); }
public SpecificObjectFrame(IDatabaseSource conn, ISpecificObjectStructure obj, ObjectEditorPars pars) { InitializeComponent(); m_pars = pars; m_conn = conn; m_obj = obj; m_objtype = obj.ObjectType; if (m_conn != null) { codeEditor1.Dialect = m_conn.Dialect; m_reformat = new ReformatToolkit(m_conn.Dialect, codeEditor1); } else { m_reformat = new ReformatToolkit(new GenericDialect(), codeEditor1); } m_repr = SpecificRepresentationAddonType.Instance.FindRepresentation(m_obj.ObjectType); FillFromStructure(); }
public ISpecificRepresentation TryFindRepresentation(string objtype) { lock (m_reprCache) { if (m_reprCache.ContainsKey(objtype)) { return(m_reprCache[objtype]); } } foreach (var item in CommonSpace.GetAllAddons()) { ISpecificRepresentation repr = (ISpecificRepresentation)item.CreateInstance(); if (repr.ObjectType == objtype) { lock (m_reprCache) { m_reprCache[objtype] = repr; } return(repr); } } return(null); }
public ISpecificRepresentation FindByElement(string elemName) { lock (m_reprElemCache) { if (m_reprElemCache.ContainsKey(elemName)) { return(m_reprElemCache[elemName]); } } foreach (var item in CommonSpace.GetAllAddons()) { ISpecificRepresentation repr = (ISpecificRepresentation)item.CreateInstance(); if (repr.XmlElementName == elemName) { lock (m_reprCache) { m_reprElemCache[elemName] = repr; } return(repr); } } return(null); }
public SpecificObjectsWidget(ISpecificObjectType dbtype) { m_dbtype = dbtype; m_repr = SpecificRepresentationAddonType.Instance.FindRepresentation(m_dbtype.ObjectType); }