Skip to content

Commit

Permalink
Merge pull request #51 from DamianEdwards/master
Browse files Browse the repository at this point in the history
Async fixes - Thanks dude!
  • Loading branch information
robconery committed Jun 8, 2011
2 parents bdfd2a2 + 6424009 commit aee0488
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Massive.cs
@@ -1,4 +1,5 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
Expand Down Expand Up @@ -120,11 +121,11 @@ public class DynamicModel:DynamicObject {
}
}
/// <summary>
/// Enumerates the reader yielding the result - thanks to Jeroen Haegebaert
/// Executes the reader using SQL async API - thanks to Damian Edwards
/// </summary>
public void QueryAsync(string sql, Action<List<dynamic>> callback, params object[] args) {
using (var conn = OpenConnection()) {
var cmd = new SqlCommand(sql,new SqlConnection(_connectionString));
using (var conn = new SqlConnection(_connectionString)) {
var cmd = new SqlCommand(sql, new SqlConnection(_connectionString));
cmd.AddParams(args);
cmd.Connection.Open();
var task = Task.Factory.FromAsync<IDataReader>(cmd.BeginExecuteReader, cmd.EndExecuteReader, null);
Expand Down

0 comments on commit aee0488

Please sign in to comment.