Click here to Skip to main content
15,880,503 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am working on a client server system which accesses data using linq.
When updateing on the client side and submitting changes the system calls the server to update the clients with the new information. The server reads the data but returns with the results before update.

How can I ensure that the server side only reads after the update is complete.

Hope I explained clearly
Posted
Updated 20-Feb-11 2:01am
v2
Comments
Yusuf 20-Feb-11 8:02am    
fixed subject typos

1 solution

Sounds like you are not commiting your updates, take a look at this:
Saving Changes and Managing Concurrency[^]

Regards
Espen Harlinn
 
Share this answer
 
Comments
milenalukic 20-Feb-11 8:07am    
using (FTNDataDataContext fdc = new FTNDataDataContext())
{
FT_User me = fdc.FT_Users.Where(x => x.FT_RMU_USR_ID==userID).First();
me.FT_RMU_Admin = true;
fdc.SubmitChanges();
}

I am using the above code from the client side and then querying a view based on the users table linked to another 2 tables to get the current users from the server side.
It appears that the view is not updated till the server reads but a couple of seconds later it is.

I believe ~I am committing the data. Had a look at that article but could not understand it.
Espen Harlinn 20-Feb-11 8:40am    
After SubmitChanges call fdc.Refresh(RefreshMode.StoreWins, ... to force an update of the object cache with corresponding values from the database.

Seems like the EF team is convinced they have a better grasp on caching than the sql server team - even if bypasing EF usually result in perfomance gains in the order of 300-500%, and that kind of makes it obvious that they don't.
milenalukic 22-Feb-11 12:15pm    
Tried this and it seems to be working on local network. Need to test further to confirm. Thanks.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900