コード例 #1
0
        public static DependencyItem[] GetSelectedDependsOn(this IDatabaseStructure db, DependencyItem selected, bool processReferences)
        {
            var res = new List <DependencyItem>();

            if (selected != null)
            {
                var obj = db.FindSpecificObject(selected.ObjectType, selected.Name);
                if (obj != null && obj.DependsOn != null)
                {
                    res.AddRange(obj.DependsOn);
                }
                if (processReferences && selected.ObjectType == "table")
                {
                    var tbl = db.FindTable(selected.Name);
                    if (tbl != null)
                    {
                        foreach (var fk in tbl.GetConstraints <IForeignKey>())
                        {
                            res.Add(new DependencyItem
                            {
                                Name       = fk.PrimaryKeyTable,
                                ObjectType = "table",
                            });
                        }
                    }
                }
            }
            return(res.ToArray());
        }
コード例 #2
0
 public static ISpecificObjectStructure FindSpecificObject(this IDatabaseStructure db, ISpecificObjectStructure obj)
 {
     return(db.FindSpecificObject(obj.ObjectType, obj.ObjectName));
 }