internal override void Bind(DataTable table, List<DataColumn> list)
{
BindTable(table);
_column = null; // clear for rebinding (if original binding was valid)
_relation = null;
if (table == null)
throw ExprException.ExpressionUnbound(ToString());
// First find parent table
DataRelationCollection relations;
relations = table.ParentRelations;
if (_relationName == null)
{
// must have one and only one relation
if (relations.Count > 1)
{
throw ExprException.UnresolvedRelation(table.TableName, ToString());
}
_relation = relations[0];
}
else
{
_relation = relations[_relationName];
}
if (null == _relation)
{
throw ExprException.BindFailure(_relationName); // this operation is not clone specific, throw generic exception
}
DataTable parentTable = _relation.ParentTable;
Debug.Assert(_relation != null, "Invalid relation: no parent table.");
Debug.Assert(_columnName != null, "All Lookup expressions have columnName set.");
_column = parentTable.Columns[_columnName];
if (_column == null)
throw ExprException.UnboundName(_columnName);
// add column to the dependency list
int i;
for (i = 0; i < list.Count; i++)
{
// walk the list, check if the current column already on the list
DataColumn dataColumn = list[i];
if (_column == dataColumn)
{
break;
}
}
if (i >= list.Count)
{
list.Add(_column);
}
AggregateNode.Bind(_relation, list);
}