Open
Description
MapToList
fails when coming accross enum properties.
Could handle them something like:
var val = dr.GetValue(colMapping[prop.Name.ToLower()].ColumnOrdinal.Value);
if(prop.PropertyType.IsEnum)
{
prop.SetValue(obj, val == DBNull.Value ? null : Enum.ToObject(prop.PropertyType, (int)val));
}
else
{
prop.SetValue(obj, val == DBNull.Value ? null : val);
}
The above isn't really finished, as it doesn't handle null correcty,- i.e should map DbNull only to nullable
enums.
Metadata
Metadata
Assignees
Labels
No labels