How do I know if the client is already open on another computer?

1

I'm making a system that can and will open on possibly 2 to 7 computers. There is concern in the following case:

  • PC1 opened the client's account and started editing.
  • PC4 has opened the client account John just to see some data.
  • PC1 has finished editing and saved.
  • PC4 decided to make a small change in the chip and saved it too.
  • In this situation the change that will prevail is that of PC4 that saved the card last, thus losing all data changed by PC1.

    Which way can I use to check if the plug is already open? Taking into account that the database is on a local network.

    Is there any clever and underperforming way of doing this? Without using database to make queries of type "if (EmUso == true)" .

    Who knows some file, some direct communication between computers. Anyway, I accept suggestions to get around this problem.

        
    asked by anonymous 23.07.2014 / 16:15

    1 answer

    1

    Finding a little bit found this SOEn post

    from which I extracted the following part:

      

    User B would be able to see the registry, but when trying to save would it give an error?

         

    This would happen if [optimistic concurrency] was being used. In NHibernate, optimistic concurrency works by adding a Version field. Saving / updating commands are sent with the data of the version in which the change is based. If the submitted version is different than persisted, NHibernate will throw an exception

    So, to protect the situation, I believe this feature will help you.

    If you want to create your own solution, you can implement a trigger to control this version number in the bank and your application from time to time, validate if the version number on the screen is different and notify the user, as well as protect the save operation to validate the registry version.

    I did not find Portuguese material about the optimistic concurrency feature, if I find I edit the answer and add it here.

        
    23.07.2014 / 16:38