It may be more of a disagreement but if the item is not Nullable<T> and it is
not typeof(string) or typeof(byte), one could argue the column is not nullable.
I added code in my example to perform this check after the !IsPk
if (IsNullable && Nullable.GetUnderlyingType(prop.PropertyType) == null
&& ColumnType != typeof(string) && ColumnType != typeof(byte[])) {
IsNullable = false;
}
public PropColumn(PropertyInfo prop) {
_prop = prop;
Name = prop.Name;
//If this type is Nullable<T> then Nullable.GetUnderlyingType returns the T, otherwise it returns null, so get the the actual type instead
ColumnType = Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType;
Collation = Orm.Collation(prop);
IsAutoInc = Orm.IsAutoInc(prop);
IsPK = Orm.IsPK(prop);
IsIndexed = Orm.IsIndexed(prop);
IsNullable = !IsPK;
MaxStringLength = Orm.MaxStringLength(prop);
}
Original issue reported on code.google.com by joseph.f...@gmail.com on 4 Dec 2010 at 4:49
Original issue reported on code.google.com by
joseph.f...@gmail.com
on 4 Dec 2010 at 4:49