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 (); } }
public DotGraphController() { _serialization = new Serialization (); _dotGraphGenerator = new DotGraphGenerator (); }