title: Running multiple select queries using the same db context
body: <p>Can you run multiple "select" queries using the same data context? Today at work, I ran into a situation where the query returns inaccurate results when I run multiple "select" queries in the same context using Entity Framework 4. The code is similar to the one below: </p>
  
  <pre><code>            using(var dataContext = new VisitorDataContext())
              {
                  var v1 = dataContext.Visitor.Where(p =&gt; p.VisitorId == 73).FirstOrDefault();
  
  //process v1
                  var v2 = dataContext.Visitor.Where(p =&gt; p.VisitorId == 98).FirstOrDefault();
  
  //process v2 
                  var v3 = dataContext.Visitor.Where(p =&gt; p.VisitorId == 100).FirstOrDefault();
  
  //provess v2
              }
  </code></pre>
  
  <p>So what happened to me was that v2 contained previous results from v1. I suspect it's because the context is not disposed until the end of this using block. I'm wondering if in the future, to avoid this error, I should dispose the context after each query. </p>