jaquel / dapper-dot-net

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

DBNull With parameter #186

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Get datacolumns with DBNull from another database
and insert it.

What is the expected output? What do you see instead?

In function AddParameters with line
if (dbType == null && val != null && !isCustomQueryParameter) dbType = 
SqlMapper.LookupDbType(val.GetType(), name, true, out handler);

cause I just put data[columnName] (data is DataRow) into parameters.
so for DynamicParameters, the 'dbType' is null, but the value is not equals 
null,
the value is equal DBNull.Value.

So I guess the boolean function may could changed to 
if (dbType == null && (val != null && val != DBNull.Value) && 
!isCustomQueryParameter)

What version of the product are you using? On what operating system?
The 1.37 dapper; Windows 8.1 x64

Original issue reported on code.google.com by bill6...@gmail.com on 29 Oct 2014 at 1:25