Beispiel #1
0
        protected override void FillTreeWithData(Selector selector, ITypeDescriptorContext context, IServiceProvider provider)
        {
            base.FillTreeWithData(selector, context, provider);
            IHaveConnectionScope source = context.Instance as IHaveConnectionScope;
            Table design;

            if (source == null)
            {
                return;
            }

            design = source.DesignTable as Table;

            using (DataTable table = source.GetConnection().GetSchema("Tables", new string[] { source.CatalogScope }))
            {
                foreach (DataRow row in table.Rows)
                {
                    bool add = true;
                    if (design != null && (row[2].ToString() == design.OldName || row[2].ToString() == design.Name))
                    {
                        add = false;
                    }

                    if (add)
                    {
                        selector.AddNode(row[2].ToString(), row[2], null);
                    }
                }
            }
            if (design != null)
            {
                selector.AddNode(design.Name, design.Name, null);
            }
        }
Beispiel #2
0
        protected override void FillTreeWithData(Selector selector, ITypeDescriptorContext context, IServiceProvider provider)
        {
            base.FillTreeWithData(selector, context, provider);
            IHaveConnectionScope source = context.Instance as IHaveConnectionScope;
            ViewTableBase        design;

            if (source == null)
            {
                return;
            }

            design = source.DesignTable;

            if (design.Name != source.TableScope)
            {
                using (DataTable table = source.GetConnection().GetSchema("Columns", new string[] { source.CatalogScope, null, source.TableScope }))
                {
                    foreach (DataRow row in table.Rows)
                    {
                        selector.AddNode(row[3].ToString(), row[3], null);
                    }
                }
            }
            else
            {
                Table tbl = design as Table;
                if (tbl != null)
                {
                    foreach (Column c in tbl.Columns)
                    {
                        selector.AddNode(c.ColumnName, c.ColumnName, null);
                    }
                }
            }
        }