This project is read-only.
1
Vote

bool? conversion cause an exception

description

Hi,

I have a MySQL table with a field as tinyint(1) with possible null value which will be mapped with a nullable boolean. The conversion fire an exception durant the mapping.

I investigate and find the cause at the line 126 of the file AutoMapper.cs :

I replace :
value = Convert.ChangeType(value, property.PropertyType)
by
value = Convert.ChangeType(value, Nullable.GetUnderlyingType(property.PropertyType) ?? property.PropertyType);

And it's working.

Best regards,

Benoit

comments