private void DeserializeRelations(SerializationInfo info, StreamingContext context)
{
ArrayList relationList = (ArrayList)info.GetValue("DataSet.Relations", typeof(ArrayList));
foreach (ArrayList list in relationList)
{
string relationName = (string)list[0];
int[] parentInfo = (int[])list[1];
int[] childInfo = (int[])list[2];
bool isNested = (bool)list[3];
PropertyCollection extendedProperties = (PropertyCollection)list[4];
//ParentKey Columns.
DataColumn[] parentkeyColumns = new DataColumn[parentInfo.Length - 1];
for (int i = 0; i < parentkeyColumns.Length; i++)
{
parentkeyColumns[i] = Tables[parentInfo[0]].Columns[parentInfo[i + 1]];
}
//ChildKey Columns.
DataColumn[] childkeyColumns = new DataColumn[childInfo.Length - 1];
for (int i = 0; i < childkeyColumns.Length; i++)
{
childkeyColumns[i] = Tables[childInfo[0]].Columns[childInfo[i + 1]];
}
//Create the Relation, without any constraints[Assumption: The constraints are added earlier than the relations]
DataRelation rel = new DataRelation(relationName, parentkeyColumns, childkeyColumns, false);
rel.CheckMultipleNested = false; // disable the check for multiple nested parent
rel.Nested = isNested;
rel._extendedProperties = extendedProperties;
Relations.Add(rel);
rel.CheckMultipleNested = true; // enable the check for multiple nested parent
}
}