title: What effect does MARS have on NHibernate?
body: <p>I'm comparing Entity Framework with NHibernate, and I'd like to know if when using SQL Server, what effect (if any) would enabling or disabling MARS support have on NHibernate?</p>
  
  <p>MARS = Multiple Active Result Sets</p>
  
  <p>The <a href="http://msdn.microsoft.com/en-us/library/bb896272.aspx" rel="nofollow">Entity Framwork documentation</a> states the following:</p>
  
  <blockquote>
    <p>When you call the <strong><code>Load</code></strong> method during a <strong><code>foreach</code></strong> (C#) or <strong><code>For Each</code></strong>
    (Visual Basic) enumeration, the Entity Framework tries to open a new
    data reader. This operation will fail unless you have enabled multiple
    active results sets by specifying <strong><code>multipleactiveresultsets=true</code></strong> in the
    connection string. For more information, see <a href="http://go.microsoft.com/fwlink/?LinkId=91577" rel="nofollow">Using Multiple Active
    Result Sets (MARS)</a> on MSDN. You can also load the result of the query
    into a List collection, which closes the data reader and enables you
    to enumerate over the collection to load referenced entities.</p>
  </blockquote>
  
  <p>Does NHibernate has the same issue?</p>
  
  <p><a href="https://web.archive.org/web/20120321141315/http://windowsazurecat.com/2011/09/understanding-sql-azure-federations-no-mars-support-and-entity-framework" rel="nofollow">Additional information when connecting to SQL Azure</a></p>