private void Validate(int index, DataTableMapping value)
{
if (null == value)
{
throw ADP.TablesAddNullAttempt(nameof(value));
}
if (null != value.Parent)
{
if (this != value.Parent)
{
throw ADP.TablesIsNotParent(this);
}
else if (index != IndexOf(value))
{
throw ADP.TablesIsParent(this);
}
}
string name = value.SourceTable;
if (string.IsNullOrEmpty(name))
{
index = 1;
do
{
name = ADP.SourceTable + index.ToString(System.Globalization.CultureInfo.InvariantCulture);
index++;
} while (-1 != IndexOf(name));
value.SourceTable = name;
}
else
{
ValidateSourceTable(index, name);
}
}