public SetParentRow ( |
||
parentRow | ||
relation | ||
return | void |
public void SetParentRow(DataRow parentRow, DataRelation relation)
{
if (relation == null)
{
SetParentRow(parentRow);
return;
}
if (parentRow == null)
{
SetParentRowToDBNull(relation);
return;
}
if (_table.DataSet != parentRow._table.DataSet)
{
throw ExceptionBuilder.ParentRowNotInTheDataSet();
}
if (relation.ChildKey.Table != _table)
{
throw ExceptionBuilder.SetParentRowTableMismatch(relation.ChildKey.Table.TableName, _table.TableName);
}
if (relation.ParentKey.Table != parentRow._table)
{
throw ExceptionBuilder.SetParentRowTableMismatch(relation.ParentKey.Table.TableName, parentRow._table.TableName);
}
object[] parentKeyValues = parentRow.GetKeyValues(relation.ParentKey);
SetKeyValues(relation.ChildKey, parentKeyValues);
}
DataRow::SetParentRow ( |
private static void SetNestedParentRow(DataRow childRow, DataRow parentRow) { DataRelation rel = GetNestedParentRelation(childRow); //we should not set this row's parentRow if the table doesn't match. if (rel != null) { if (parentRow == null || rel.ParentKey.Table != parentRow.Table) childRow.SetParentRow(null, rel); else childRow.SetParentRow(parentRow, rel); } }