private void Create(string relationName, DataColumn[] parentColumns, DataColumn[] childColumns, bool createConstraints)
{
long logScopeId = DataCommonEventSource.Log.EnterScope("<ds.DataRelation.Create|INFO> {0}, relationName='{1}', createConstraints={2}", ObjectID, relationName, createConstraints);
try
{
_parentKey = new DataKey(parentColumns, true);
_childKey = new DataKey(childColumns, true);
if (parentColumns.Length != childColumns.Length)
{
throw ExceptionBuilder.KeyLengthMismatch();
}
for (int i = 0; i < parentColumns.Length; i++)
{
if ((parentColumns[i].Table.DataSet == null) || (childColumns[i].Table.DataSet == null))
{
throw ExceptionBuilder.ParentOrChildColumnsDoNotHaveDataSet();
}
}
CheckState();
_relationName = (relationName == null ? "" : relationName);
_createConstraints = createConstraints;
}
finally
{
DataCommonEventSource.Log.ExitScope(logScopeId);
}
}