ASP.NET MVC Object locking mechanism
I'm working on a ASP.NET MVC 2 web application that lets users edit parameters on a simulation and launch it. Once a user starts editing a specific simulation, it must be inaccessible to other users.
Is there an easy way to achieve that goal in ASP.NET MVC?
My first idea was to put the logged on user's identity in the Application collection, along with the simulation: Application.Add((Guid)Memb开发者_Go百科ership.GetUser().ProviderUserKey, simulationId);
Then I would remove it in the Session_End method, when the session expires. However, the Session_End method is never called with those parameters in the web.config file: sessionState mode="InProc" timeout="1"
What am I doing wrong? / Is there a better mechanism?
Hard to do in a web application. Can you tell us why? usually collision detection is used in this instance and the first updater wins. The second updaters can either be told "refresh your data and retry" or you can try to apply or merge the changes and offer to save the newer version.
精彩评论