Commit f12f30d8 authored by Marc Gravell's avatar Marc Gravell

Merge pull request #141 from mkonstan/master

It does not look like we need above if since we are typecasting value to...
parents 33c5976a f6e29fec
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.XML" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\Dapper NET40\Properties\AssemblyInfo.cs"> <Compile Include="..\Dapper NET40\Properties\AssemblyInfo.cs">
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.XML" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="SqlMapper.cs" /> <Compile Include="SqlMapper.cs" />
......
...@@ -1420,10 +1420,7 @@ private static IEnumerable<T> QueryImpl<T>(this IDbConnection cnn, CommandDefini ...@@ -1420,10 +1420,7 @@ private static IEnumerable<T> QueryImpl<T>(this IDbConnection cnn, CommandDefini
while (reader.Read()) while (reader.Read())
{ {
object val = func(reader); object val = func(reader);
if (effectiveType == typeof(object)) if (val == null || val is T) {
{
yield return (T)(object)val;
} else if (val == null || val is T) {
yield return (T)val; yield return (T)val;
} else { } else {
yield return (T)Convert.ChangeType(val, effectiveType, CultureInfo.InvariantCulture); yield return (T)Convert.ChangeType(val, effectiveType, CultureInfo.InvariantCulture);
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.XML" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\Dapper NET40\Properties\AssemblyInfo.cs"> <Compile Include="..\Dapper NET40\Properties\AssemblyInfo.cs">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment