views:

21

answers:

1

Hi all, I have a weired problem. One of the pages in my application show's status 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?

+1  A: 

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.

Craig Stuntz
In my application i am using Spring.Net to inject the EDM object to the ASP page. Does that mean its shared and stays alive?!?
Abdel Olakara
I haven't used Spring.Net, but most DI containers allow you to configure the lifetime of the returned object. Many have a "per-request" lifetime already built. That's what you want. Sometimes the default will be "singleton", which would explain the behavior you're seeing.
Craig Stuntz