internal DataTable FindTable(DataTable baseTable, PropertyDescriptor[] props, int propStart)
{
if (props.Length < propStart + 1)
{
return baseTable;
}
PropertyDescriptor currentProp = props[propStart];
if (baseTable == null)
{
// the accessor is the table name. if we don't find it, return null.
if (currentProp is DataTablePropertyDescriptor)
{
return FindTable(((DataTablePropertyDescriptor)currentProp).Table, props, propStart + 1);
}
return null;
}
if (currentProp is DataRelationPropertyDescriptor)
{
return FindTable(((DataRelationPropertyDescriptor)currentProp).Relation.ChildTable, props, propStart + 1);
}
return null;
}