quangdd5757 / dapper-dot-net

Automatically exported from code.google.com/p/dapper-dot-net
Other
0 stars 0 forks source link

Enum problem while inserting #134

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When inserting a model that has an enum property I run into a problem having a 
value larger than the expected range, a "The value is outside the expected 
range" is thrown on line 2881

To fix this problem I changed 

                   p.Value = val ?? DBNull.Value;

to

                   if (val is Enum)
                      p.Value = (int)val;
                   else
                      p.Value = val ?? DBNull.Value;

Original issue reported on code.google.com by unki...@gmail.com on 27 Mar 2013 at 2:35