Add missing using statement to reader #150

Closed
wants to merge 1 commit into
from
View
@@ -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(); ;
+ }
}
}
}