1

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 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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?!?
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.