title: Keep entity framework context open
body: <p>I have a few sets of data that are used by all users on site. I would traditionally look at caching these.</p>
  
  <p>My current EF setup uses uow and repository patterns, so I tend to use context for a single transaction and dispose of it.</p>
  
  <p>I plan to introduce some user interaction, so the data that was once entirely static, won't be as users will be allowed to add, delete and perhaps edit. I estimate that data will still only be refreshed every 2 minutes or so still a reasonable candidate for caching.</p>
  
  <p>One option would be to keep with the cache idea, but retrieve and recache after each change. The biggest data sets will have around 5-10k rows.</p>
  
  <p>Another option I thought of would be to have a single context for each data set which I keep open (static) and manage the data that way. I'm pretty new to EF so I'm not sure whether this is a good or bad idea but on face value it seems similar to the way caching would work. The only thing I'm unsure of is how to deal with the additional table data as I believe you can't track and use Include().</p>
  
  <p>Anyone got advise on this?  </p>