title: TdsParserStateObject - disposing ? Entity Framework
body: <p>I'm using EF and have problem with <code>TdsParserStateObject</code>.</p>
  
  <p>I'm calling this method many times :</p>
  
  <pre><code> public void SaveDataFromERP(string synchronizationType, string xml,int errorsHandlingPercentagePartition)
      {
          var param1 = new SqlParameter("XML", SqlDbType.Xml);
          param1.Value = xml;
          var param2 = new SqlParameter("PartitionedPackagePercentage", SqlDbType.Int);
          param2.Value = errorsHandlingPercentagePartition;
          ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreQuery&lt;dynamic&gt;(
              $"exec [Synchronization].[Import{synchronizationType}] @XML,  @PartitionedPackagePercentage", param1 , param2 );
  }
  </code></pre>
  
  <p>My repository consists of </p>
  
  <pre><code>SynchronizationRepository : ISynchronizationRepository
  {
    private readonly POSDBContext _context = new POSDBContext();
    public void SaveData(string typeName, string xmlFile, int errorsHandlingPartitionPercentage)
      {
          _context.SaveData(typeName, xmlFile,errorsHandlingPartitionPercentage);
      }
   }
  </code></pre>
  
  <p>When I call <code>ExecuteStoreQuery</code> I can see new object in memory <code>TdsParserStateObject</code>.</p>
  
  <p>Unfortunately I must call this method in sequence many times(a lot of data). The result is about 60 <code>TdsParserStateObject</code> and it take a lot of memory. </p>
  
  <p>Moreover these objects do not disappear after some time. </p>
  
  <p>Is it possible to dispose them ? </p>
  
  <p><a href="https://i.stack.imgur.com/AyAjm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/AyAjm.png" alt="enter image description here"></a></p>