Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Add missing using statement to reader #150

wants to merge 1 commit into from

3 participants


No description provided.


Thanks for this - have you tested it to be sure it works? I seem to recall it clipping the connection?


It should not clip the connection if you are seeing clipping in this call with the using it shouldn't be caused by the using itself and would be exposing a bug else. However you are doing the same thing yourself already in the other Query override that takes a connection.

I also have addressed this myself and haven't noticed any issues with clipping yet. I submitted the same fix for all files, that also included fixes for two NullReferenceException in the Validates methods.


Commented on other thread - I need something more concrete here. The reader is in the scope of the connection and when it dies, so does the reader. This, to me, seems like overkill and not needed.

If you've seen something different, I'm happy to re-open.

@robconery robconery closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 10, 2012
  1. @davidsavagejr
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 3 deletions.
  1. +6 −3 Massive.cs
9 Massive.cs
@@ -195,9 +195,12 @@ public class DynamicModel : DynamicObject {
/// </summary>
public virtual IEnumerable<dynamic> Query(string sql, params object[] args) {
using (var conn = OpenConnection()) {
- var rdr = CreateCommand(sql, conn, args).ExecuteReader();
- while (rdr.Read()) {
- yield return rdr.RecordToExpando(); ;
+ using (var rdr = CreateCommand(sql, conn, args).ExecuteReader())
+ {
+ while (rdr.Read())
+ {
+ yield return rdr.RecordToExpando(); ;
+ }
Something went wrong with that request. Please try again.