What steps will reproduce the problem?
1. Create a sproc with an output parameter
2. In the sproc set the parameter to null
3. Use DynamicParameters to add an output parameter
4. Call sproc with dapper
5. Use DynamicParameters.Get<T> to get value
What is the expected output? What do you see instead?
For dbnulls to be treated as nulls and casted to the destination type
accordingly. Getting an invalid cast exception instead @
"Dapper.DynamicParameters.Get[T](String name)" line 1589.
What version of the product are you using? On what operating system?
1.5, Windows 7, Sql Server 2008 R2
Please provide any additional information below.
Locally I've added a DBNull check to "public T Get<T>(string name)" changing it
from:
(T)parameters[Clean(name)].AttachedParam.Value;
to
var value = parameters[Clean(name)].AttachedParam.Value;
return (T)(value == DBNull.Value ? null : value);
which works well enough.
Original issue reported on code.google.com by czy...@gmail.com on 15 Jul 2011 at 5:56
Original issue reported on code.google.com by
czy...@gmail.com
on 15 Jul 2011 at 5:56