leeshuiwua / dapper-dot-net

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

Do not set IDataParameter.DbType when creating input parameters #159

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
See this StackOverflow question:

    http://stackoverflow.com/q/19362113/13087

It seems to me that the DynamicParameters.AddParameters method shouldn't 
explicitly set the DbType or size for input parameters, unless explicitly 
requested by the caller.

I.e. the following line should be removed:

    if (dbType == null && val != null) dbType = SqlMapper.LookupDbType(val.GetType(),name);

When writing ADO.NET code by hand, one doesn't generally explicitly set the 
DbType.

Original issue reported on code.google.com by Jocular...@hotmail.com on 17 Oct 2013 at 1:45