internal override void Bind(DataTable table, List <DataColumn> list)
{
BindTable(table);
if (table == null)
{
throw ExprException.AggregateUnbound(this.ToString());
}
if (local)
{
relation = null;
}
else
{
DataRelationCollection relations;
relations = table.ChildRelations;
if (relationName == null)
{
// must have one and only one relation
if (relations.Count > 1)
{
throw ExprException.UnresolvedRelation(table.TableName, this.ToString());
}
if (relations.Count == 1)
{
relation = relations[0];
}
else
{
throw ExprException.AggregateUnbound(this.ToString());
}
}
else
{
relation = relations[relationName];
}
}
childTable = (relation == null) ? table : relation.ChildTable;
this.column = childTable.Columns[columnName];
if (column == null)
{
throw ExprException.UnboundName(columnName);
}
// add column to the dependency list, do not add duplicate columns
Debug.Assert(column != null, "Failed to bind column " + columnName);
int i;
for (i = 0; i < list.Count; i++)
{
// walk the list, check if the current column already on the list
DataColumn dataColumn = (DataColumn)list[i];
if (column == dataColumn)
{
break;
}
}
if (i >= list.Count)
{
list.Add(column);
}
// SQLBU 383715: Staleness of computed values in expression column as the relationship end columns are not being added to the dependent column list.
AggregateNode.Bind(relation, list);
}