Question

Not sure why this just started happening, but I have a situation where an entity I am reading from the database doesnt contain the new values that were updated from a stored procedure before. I see the changes in the database after my stored procedure makes the update, and I also call UnitOfWork.Commit to save any other changes. I think make a call to get this item again, and the values are not the same as the ones in the database. Any reason for this? I am not grabbing this item anywhere before the update so I dont know how EF knows about it the first time I grab it after the update.

Was it helpful?

Solution 2

I moved some logic around so the item is updated before any EF calls.

OTHER TIPS

I'm going to guess Entity Framework is caching those values somehow. I would try using the Refresh() method to force Entity Framework to go back to the data store with RefreshMode.StoreWins to ensure the data store values win.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top