Is it possible to disable materialized objects cache in Entity Framework 5.0, so that multiple queries actually perform queries to SQL Server, but at the same time leave concurrent changes check so that if an entity in database is updated by another client our client throws an exception when we perform an attemp to update this entity without refreshing it from the database?
Asked
Active
Viewed 436 times
0
-
If you don't cache your client's remembered state of the objects, how are you going to detect when someone else has modified it to no longer match that state? – anaximander Jul 12 '13 at 11:05
-
Is there any way to force query to perform a request to DB if there is already loaded entity in current ObjectContext? – Mikhail Brinchuk Jul 12 '13 at 12:23
-
There's always [`Refresh()`](http://msdn.microsoft.com/en-us/library/bb896255.aspx), which you could do [like this](http://stackoverflow.com/questions/1746941/objectcontext-refresh) (which I wouldn't advise) or by picking out the specific objects you're after, like your query results at the time. – anaximander Jul 12 '13 at 12:39
-
Look at [optimistic concurrency](http://msdn.microsoft.com/en-us/data/jj592904.aspx). – Gert Arnold Jul 12 '13 at 13:48