AutoRefresh Entity Framework Data after insert in ASP.Net

Tanzeel
 
on Apr 18, 2014 05:32 AM
4662 Views

Hello Everyone
 
Hope you are doing well. As the title of this question depicts that what sort of issue i am facing. So furthermore i am writing the details below.
 
I have DAL using Entity framework 4 and in my helper library there is shared/static datacontext object which basically points to DAL. Whenever datacontext object is needed for any operation on page. The shared/static datacontext object is returned to the page. I am using datacontext object with LazyLoadingEnabled = False. That is all about how the datacontext object is used on my pages
 
Now comming to the problem. Whenever i do insertion, deletion or updation operation using entity framework, it portrays the changes after the operation (no issue). When i used stored procedure in entity framework for any operation. Some times it doesn't portrays the changes after the operation. After sometime(about 5 min) changes can be seen on the application side. When i look into the database (After using stored procedure in entity framework) changes are there. It is not showing this annoying sort of behavior every time. 
 
Now my question is 
 
1) Is this behavior due to shared/static data context object.
2) If shared/static data context object isn't the problem, then why this annoying behavior.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
Azim
 
on Apr 18, 2014 07:13 AM

After insertion or updation you need to reload your Entities

 

Or you can refer this one

http://www.codeproject.com/Articles/233770/AutoRefresh-Entity-Framework-data-using-SQL-Server

Thank You.