title: Confused about static methods with Entity Framework
body: <p>I'm calling the following from my controller:</p>
  
  <pre><code>public ViewResult Index()
  {
      var users = SecurityHelpers.GetAllStaff();
      return View(users);
  }
  </code></pre>
  
  <p>The method I'm calling to get all my users looks like this:</p>
  
  <pre><code>public class SecurityHelpers
  {
      private static Context db = new Context();
  
      public static IQueryable&lt;ApplicationUser&gt; GetAllStaff()
      {            
          var users = db.Users
                  .OrderBy(x =&gt; x.FirstName).ThenBy(x =&gt; x.LastName);            
          return users;
      }
  }
  </code></pre>
  
  <p>My problem is that when I modify a staff member, such as by setting a disabled boolean, the method is bring back their old data (so the disabled user is still enabled).  I think this is because static functions are cached until the app pool recycles?</p>
  
  <p>Is there a way to also get the latest data from this method without making it non-static? (as there is a lot of code that will need to be changed to instatiate the object each time, and I don't think that's the right architecture)</p>