internal void CheckForLoops(DataRelation rel)
{
// don't check for loops in the diffgram
// because there may be some holes in the rowCollection
// and index creation may fail. The check will be done
// after all the loading is done _and_ we are sure there
// are no holes in the collection.
if (_table._fInLoadDiffgram || (_table.DataSet != null && _table.DataSet._fInLoadDiffgram))
{
return;
}
int count = _table.Rows.Count, i = 0;
// need to optimize this for count > 100
DataRow parent = GetParentRow(rel);
while (parent != null)
{
if ((parent == this) || (i > count))
{
throw ExceptionBuilder.NestedCircular(_table.TableName);
}
i++;
parent = parent.GetParentRow(rel);
}
}