protected virtual DataTable FillSchema(DataTable dataTable, SchemaType schemaType, IDbCommand command, CommandBehavior behavior)
{
long logScopeId = DataCommonEventSource.Log.EnterScope("<comm.DbDataAdapter.FillSchema|API> {0}, dataTable, schemaType, command, behavior={1}", ObjectID, behavior);
try
{
if (null == dataTable)
{
throw ADP.ArgumentNull(nameof(dataTable));
}
if ((SchemaType.Source != schemaType) && (SchemaType.Mapped != schemaType))
{
throw ADP.InvalidSchemaType(schemaType);
}
if (null == command)
{
throw ADP.MissingSelectCommand(ADP.FillSchema);
}
string srcTableName = dataTable.TableName;
int index = IndexOfDataSetTable(srcTableName);
if (-1 != index)
{
srcTableName = TableMappings[index].SourceTable;
}
return (DataTable)FillSchemaInternal(null, dataTable, schemaType, command, srcTableName, behavior | CommandBehavior.SingleResult);
}
finally
{
DataCommonEventSource.Log.ExitScope(logScopeId);
}
}