title: How to filter entities that are deleted using linq to entities
body: <p>I have a singleton DBContext but for some reason when the instance is shared across 2 methods does not populate the changes made in other method. </p>
  
  <p>Eg: <code>Method1Delete2RowS()</code> will delete 2 rows.<br>
  <code>Method2()</code> reads all rows that are not deleted</p>
  
  <p>My method 2 always shows deleted records too. Cause i have not accepted any changes yet. </p>
  
  <p>I used something like this</p>
  
  <pre><code>context.Students.Where(x =&gt; context.ObjectStateManager.GetObjectStateEntry(x)
                              .State != System.Data.EntityState.Deleted);
  </code></pre>
  
  <p>but this code throws an exception that "GetObjectStateEntry()" cannot be recognized by LINQ.</p>
  
  <p>How can I fix this?</p>