I have a stored procedure that loops through a table and it may insert some records in to that table . Its working fine . I can see the changes in db using management studio .
The problem is after that i will call another stored procedure which will return a collection .But it always return a cached value or something like that .The latest changes in db not reflecting in the returned list .Any ideas?
EDIT
I am importing stored procedure to function using EF. All the operations i made is via EF.
Chek following code
TraktorumEntities db = new TraktorumEntities();
var test= db.GetAvailableAttributes(CategoryID).ToList(); // here i get cached values .How can i force to fetch data from data base
If you are querying using the same key, EF will have your results cached.
Note the section of “MergeOption.OverwriteChanges” here
Walkthrough: Mapping an Entity to Stored Procedures (Entity Data Model Tools)
You need to tell EF to ‘get new data and overwrite the locally stored version’ with this option.
Also you don’t really tell us exactly how you are querying this data either. Is this a mapped stored procedure (mapped to an entity operation) or calling it directly on the context, or….?
EDIT
Try something along these lines