title: NHibernate caching issue - When to call Evict?
body: <p>I've run into an apparent caching issue where what's being returned by NHibernate is not matching up with what's in the DB.</p>
  
  <p>I believe this is level2 cache data.  It looks like I can use the Evict to do this, but <strong>when should the Evict method actually be called?</strong>  For my particular application, the data is going to be unique to the user and chances are the data provided will only be used once*.  </p>
  
  <p><strong>Can I disable Level2 caching for these sets of objects completely?</strong></p>
  
  <p><em>UPDATE 10/31</em></p>
  
  <p>My scenario is this: I have a shopping cart where the customer is going to be adding and removing items.  What I am doing is the following: before the updates to the cart are processed, I evict the <code>Cart</code> and <code>CartProduct</code> entities. Once this is done, I retrieve the list of <code>CartProducts</code> from the provider and return the view (this is happening in a .NET MVC Controller).  </p>
  
  <p><em>UPDATE 11/3</em></p>
  
  <p>The shopping cart has since been finished, and I ran into an issue that appeared to be related to the same NHibernate issue, but in fact was an MVC issue.  Deeper digging revealed that the HTML Helper extensions were overriding the value I supposed and replacing with what was in the Model state.  So a double whammy on this one.  Hope this helps someone.</p>