title: NHibernate: There is already an open DataReader associated with this Connection which must be closed first
body: <p>I'm having an issue with NHibernate loading data from a MySQL database. When I run this code (and this is the only time a NHibernate session is created) it throws an exception at the first }. The exception is:</p>
  
  <p>"There is already an open DataReader associated with this Connection which must be closed first."</p>
  
  <p>I don't know why this is happening?</p>
  
  <pre><code>   // ----snip----
  
          var sessionFactory = NHibernateSessionHelper.CreateSessionFactory();
          using (var session = sessionFactory.OpenSession())
          {
              using (session.BeginTransaction())
              {
                  _timeRecords = session
                      .CreateQuery(
                          "select tr from TimeRecord as tr where tr.Billable = true and tr.InvoiceDate is null and tr.CheckedOn is not null")
                      .Enumerable&lt;TimeRecord&gt;();
              } // Exception is thrown here
          }
  
     // ----snip----
  
  class NHibernateSessionHelper
  {
      public static ISessionFactory CreateSessionFactory()
      {
          return Fluently.Configure()
              .Database(
                  MySQLConfiguration
                      .Standard.ConnectionString(c =&gt; c
                                                          .Server("db01.redknot.nl")
                                                          .Database("todo_youngguns_nl")
                                                          .Username("youngguns.nl")
                                                          .Password(""))
                      .ShowSql()
              )
              .Mappings(m =&gt;
                        m.FluentMappings.AddFromAssemblyOf&lt;UserMap&gt;())
              .BuildSessionFactory();
      }
  }
  </code></pre>