Anupam- / dapper-dot-net

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

Three-type multimap with GridReader throws an exception #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a query to return multiple result sets, one of which will create an 
object with two additional types (see attached test).
2. Run the query, mainly the result set for the three objects

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

The object with two nested objects should be returned from the Read method.  
Instead, an exception is thrown:

Unable to cast object of type 
'System.Func`4[SqlMapper.Tests+Post,SqlMapper.Tests+User,SqlMapper.Tests+Comment
,SqlMapper.Tests+Post]' to type 
'System.Func`3[SqlMapper.Tests+Post,SqlMapper.Tests+User,SqlMapper.Tests+Post]'.

What version of the product are you using? On what operating system?
v1.4, Windows 7 64bit Ultimate

Please provide any additional information below.
The problem is in the GridReader class, the MultiReadInternal method.  When 
SqlMapper.MultiMapImpl is called, it is ignoring all but the first two type 
parameters, instead using DontMap.  Changing this to use the other types makes 
it function correctly (see attached file).

Original issue reported on code.google.com by bdow...@gmail.com on 15 Jul 2011 at 2:18

Attachments:

GoogleCodeExporter commented 9 years ago
oops ... great catch ... committing a fix and sending to nuget ... 

Original comment by sam.saff...@gmail.com on 19 Jul 2011 at 4:54