Пример #1
0
 public void WriteNeato()
 {
     var v = _serialization.Deserialize ();
     var probableForeignKeyConstraints = new PropableForeignKeyAnalysis ().GetProbableForeignKeys (v.Tables);
     _dotGraphGenerator.GenerateDotFile (v.Tables, v.ForeignKeyConstraints.Union (probableForeignKeyConstraints));
     _dotGraphGenerator.WriteNeato ();
 }
Пример #2
0
        public IEnumerable<string> Find(string starttable)
        {
            var v = new Serialization ().Deserialize ();
            var probableForeignKeyConstraints = new PropableForeignKeyAnalysis ().GetProbableForeignKeys (v.Tables);
            var constraints = v.ForeignKeyConstraints.Union (probableForeignKeyConstraints)
                .Where (fk => !fk.TableNames ().Any (p =>
                    p.ToLower ().EndsWith ("temp")
                    || p.ToLower ().EndsWith ("old")));
            var tables1 = v.Tables.Where (p => constraints.Any (fk => fk.TableNames ().Any (name => name == p.TableName)));
            var g = Graph (constraints, tables1);

            if (true) {
                var found = new List<string> ();
                var org = g.GetVertex (starttable);
                var outv = System.Console.Out;
                foreach (var vertex in g.Vertices) {
                    if (!vertex.HasIncidentEdgeWith (org) && !new BredthFirstSearch (vertex, org) { maxDepth = 3, outv = outv }.Bfs ().Found ()) {
                        found.Add (vertex.Data);
                    }
                }
                yield return "-----------------";
                foreach (var value in found) {
                    yield return (value);
                }
            }
            if (false) {
                var traversal = new BredthFirstSearch (g.GetVertex (starttable),
                                                      g.GetVertex ("customercategory")) { outv = System.Console.Out };
                traversal.Bfs ();
                //w.Flush();
                traversal.ConstructPaths ();
            }
        }