asr0 / dapper-dot-net

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

GridReader.Read should be eager #120

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi

var gr = con.QueryMultiple(...);
var t1 = gr.Read();
var t2 = gr.Read(); 

The second call fails as the previous call to Read has not materialized yet.

It seems to common pattern is to do: 

var t1 = gr.Read().Single();
var t2 = gr.Read().ToList(); 

Which does work, but it is not intuitive that they are required. 

Also given the second call fails in the first example, I cannot see any reason 
to use the GridReader in a deferred fashion.

Thanks

leppie

PS: /* don't spol the existing exception */ x 2 in SqlMapper.cs

Original issue reported on code.google.com by xacc....@gmail.com on 26 Oct 2012 at 5:22

GoogleCodeExporter commented 8 years ago
You're right - I've made it buffered by default (just like the main Query<T> 
method), but added the *ability* to read individual results non-buffered, which 
is useful for large-data scenarios. I'll merge the branches shortly. 

Original comment by marc.gravell on 26 Oct 2012 at 7:13

GoogleCodeExporter commented 8 years ago
pushed; just waiting on a nuget deploy

Original comment by marc.gravell on 26 Oct 2012 at 7:21