title: Entity Framework There is already an open DataReader associated with this Command which must be closed first
body: <p>I'm struggling with the error above. I found differente answers here (stack overflow), but none of them solve my problem related with the error.</p>
  
  <p>I just enable MARS in my ConnectionString but without success.</p>
  
  <p>I have a class Product</p>
  
  <pre><code>public class Product
  {
      public Product()
      {
          this.Additives = new HashSet&lt;Additive&gt;();
      }
  
      public int Id { get; set; }
      public string Name { get; set; } // refrigerante
      public string CommercialName { get; set; } // nome popular, ex: fanta laranja
      public string Brand { get; set; } // marca, ex: Coca-cola
      public string Details { get; set; } // composicao, ingredientes
      public HalalState HalalState { get; set; } // estado: halal, haram ou desconhecido
      public DateTime? LastUpdate { get; set; } // date e hora do registo
  
      public virtual ICollection&lt;Additive&gt; Additives { get; set; } // aditivos
      public int ProviderID { get; set; }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and class Additive representing additives in products</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  
  namespace Teknowhow.EatHalal.Core.Models
  {
      public class Additive
      {
          public Additive()
          {
              this.Products = new HashSet&lt;Product&gt;();
          }
  
          public int Id { get; set; }
          public string Key { get; set; } // codigo ex: E130
          public string NamePT { get; set; } // nome ex: Acido ascorbico (Vitamina C) em portugues
          public string NameEN { get; set; } // nome ex: Acido ascorbico (Vitamina C) em inglês
          public string Details { get; set; } // detalhes sobre o aditivo, incluindo.
          public HalalState HalalState; // estado: halal, haram ou desconhecido
          public DateTime? LastUpdate { get; set; } // date e hora do registo
  
          public virtual ICollection&lt;Product&gt; Products { get; set;}
      }
  }
  </code></pre>
  
  <p>I'm writing a code to implement a method on ProductRepository in order to get products with specific additive.</p>
  
  <pre><code>public ICollection&lt;Product&gt; GetProductsByAdditive(string key)
  {
      var products = context.Products;
      var productsAdditives = new List&lt;Product&gt;();
  
       foreach (var p in products)
       {
           var additives = p.Additives;
  
           foreach (var a in additives)
           {
               if (a.Key.Equals(key))
                  productsAdditives.Add(p);   
  
           }
      }
  
      return productsAdditives.ToList();
      //TODO: um Metodo úinico que permite pesquisa por nome em PT e EN e codigo 
  
  }
  </code></pre>
  
  <p>The error occurs exactly after the first foreach loop, on this statement:</p>
  
  <pre><code>var additives = p.Additives;
  </code></pre>
  
  <p>PS: I'm using EF 6.
  I'm stacked! Please help!</p>
  
  <p>Heres my Connections</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
          &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt;
      &lt;/configSections&gt;
      &lt;connectionStrings&gt;
      &lt;add name="EatHalal" 
           providerName="System.Data.SqlClient" 
           connectionString="Server=192.168.1.150;Database=EatHalal;User Id=user;Password=password;MultipleActiveResultSets=true;"
               /&gt;
    &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>