public DataColumn(string columnName, Type dataType, string expr, MappingType type)
{
GC.SuppressFinalize(this);
DataCommonEventSource.Log.Trace("<ds.DataColumn.DataColumn|API> {0}, columnName='{1}', expr='{2}', type={3}", ObjectID, columnName, expr, type);
if (dataType == null)
{
throw ExceptionBuilder.ArgumentNull(nameof(dataType));
}
StorageType typeCode = DataStorage.GetStorageType(dataType);
if (DataStorage.ImplementsINullableValue(typeCode, dataType))
{
throw ExceptionBuilder.ColumnTypeNotSupported();
}
_columnName = columnName ?? string.Empty;
SimpleType stype = SimpleType.CreateSimpleType(typeCode, dataType);
if (null != stype)
{
SimpleType = stype;
}
UpdateColumnType(dataType, typeCode);
if (!string.IsNullOrEmpty(expr)) // its a performance hit to set Expression to the empty str when we know it will come out null
{
Expression = expr;
}
_columnMapping = type;
}