/// <include file='doc\DataExpression.uex' path='docs/doc[@for="DataExpression.Bind"]/*' />
public virtual void Bind(DataTable table)
{
#if DEBUG
if (CompModSwitches.DataExpression.TraceVerbose)
{
Debug.WriteLine("Bind current expression in the table " + (table != null ? table.TableName : "null"));
}
#endif
this.table = table;
if (table == null)
{
return;
}
if (expr != null)
{
Debug.Assert(parsed, "Invalid calling order: Bind() before Parse()");
ArrayList list = new ArrayList();
expr.Bind(table, list);
expr = expr.Optimize();
this.table = table;
optimizedExpression = null;
Debug.Assert(list != null, "Invlid dependency list");
bound = true;
dependency = new DataColumn[list.Count];
list.CopyTo(dependency, 0);
#if DEBUG
if (dependency == null)
{
if (CompModSwitches.DataExpression.TraceVerbose)
{
Debug.WriteLine("no dependencies");
}
}
else
{
if (CompModSwitches.DataExpression.TraceVerbose)
{
Debug.WriteLine("have dependencies: " + dependency.Length.ToString());
}
for (int i = 0; i < dependency.Length; i++)
{
//UNDONE : Debug.WriteLineIf("DataExpression", dependency[i].ColumnName);
}
}
#endif
}
}