private ArrayList GetSelfAndDescendants(DataTable dt)
{ // breadth-first
ArrayList tableList = new ArrayList();
tableList.Add(dt);
int nCounter = 0;
while (nCounter < tableList.Count)
{
foreach (DataRelation childRelations in ((DataTable)tableList[nCounter]).ChildRelations)
{
if (!tableList.Contains(childRelations.ChildTable))
tableList.Add(childRelations.ChildTable);
}
nCounter++;
}
return tableList;
}
// Used to infer schema and top most node