开发者

Avoid getting data from entity framework's cache

开发者 https://www.devze.com 2023-01-03 09:28 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消