Avoid getting data from entity framework's cache
I have a weired problem. One of the pages in my application show's status 开发者_Python百科of tasks in a table. I am using entity framework ( entity to object) to do all the data handling with DB. I noticed that even though the status is updated in DB, its not reflected on my webpage even after continuous refresh! If i stop the server and start the application again (currently running on VS2008 dev server) the updated data is displayed!
Am I seeing the cached data? how do I prevent this from happening?
Your ObjectContext
lifetime should be a single request. If you have a static context which stays alive forever, you'll see stale data... forever. Here's an example of how to do it.
精彩评论