Example #1
0
        //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);
        }
Example #2
0
        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());
        }