Click here to Skip to main content
13,197,767 members (40,414 online)
Rate this:
 
Please Sign up or sign in to vote.
I have an MVC app that uses EF 6. In a custom repository, I am updating an entity's CurrentValues via SetValues. A little later on, I have the unit of work perform a Commit(). If, after closing the page on which I made the edits, I return to said page, the changes are not reflected. If I close and reopen my browser, the changes are reflected. What am I missing?

What I have tried:

I've debugged to ensure the code is all executing without any exceptions.
Posted 22-Feb-17 11:59am
Comments
Graeme_Grant 22-Feb-17 18:01pm
   
Please post your code so that we can see exactly what you are doing. It could be something like a caching setting. Without code, we can't help as we cannot see your screen from ours.
Valery Possoz 22-Feb-17 18:12pm
   
looks like there could be a static property somewhere?
Dave Kreskowiak 22-Feb-17 19:43pm
   
What kind of app? If this is a web app you might be getting bit by a page cache.

Normally you save changes with yourDbContext.SaveChanges(), not just a transactionContext.Commit().

Without seeing the relevant code, it's pretty much impossible to tell you what's going on without a ton of guessing.
Dhrup_HK 23-Feb-17 2:11am
   
Hay I m also MVC 5 developer, and in my point of view, while use MVC please use custom methods because it's easily understandable even after complex code. but if u r use MVC + entity framework so each time you need to delete model while any if modification in db or any code. in addition to that, it is more difficult to set conditional statement with entity framework.
I M Telling as per my experiences.
Nathan Minier 23-Feb-17 7:19am
   
You're being slammed by the page cache by mixing views with AJAX. Pick one and update appropriately after transactions.
TimWallace 24-Feb-17 12:23pm
   
That was the issue. I marked my action appropriately and the issue went away. Thanks for the input!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.171020.1 | Last Updated 22 Feb 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100