We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ec82ce8 commit e3006fcCopy full SHA for e3006fc
src/DotNetToolkit.Repository.AdoNet/Internal/DbDataReaderExtensions.cs
@@ -7,16 +7,19 @@ internal static class DbDataReaderExtensions
7
{
8
public static T GetValue<T>(this DbDataReader reader, int ordinal)
9
10
+ var t = typeof(T);
11
var value = reader.GetValue(ordinal);
12
13
if (value == null || value == DBNull.Value)
14
15
return default(T);
16
}
- else
17
+ else if (t.IsGenericType && t.GetGenericTypeDefinition().Equals(typeof(Nullable<>)))
18
- return (T)value;
19
+ t = Nullable.GetUnderlyingType(t);
20
21
+
22
+ return (T)Convert.ChangeType(value, t);
23
24
25
0 commit comments