.net - What is a good method to determine when an entities data has been changed on the database? -


Say, I have retrieved one unit from the database using the unit framework. Is there any way to check that there is only one specific unit changed by another user in the database?

The method I used before (in WinForm applications) was:

  • DB to save the unit
  • The unit type, unique identifier , And add a listing in the transaction table with date change time
  • When refreshing the same unit, check the rows of the current table after the transaction table.
  • If an entry is found, then act accordingly (reload the unit from the database, stop editing, save collision, etc. depending on why I am checking the change).
    • For this reason, I want to do this:
      • Avoid reloading the entire group of units and refresh only those items
      • Check conflicts of conflicts on Save
      • Resolve concurrent opposition when editing begins. To do this, I need to make an entry in the transaction table when a user starts to edit and update the same transaction table row when user saves / cancellation.

        Does this method seem right? Is the reason for doing this right? And probably already have the functionality to do that I do not know?

        I wonder why you do not use more standard ways of optimistic concurrency. For EF, I think that a separate transaction table combines complexity only because you always have to maintain the entries in that table while operating the CRUD on the main institutions. What happens when a user manages and creates a "locking" entry in the transaction table, but then crashes? The database will not have exclusive lock on the record (i.e. pessimistic locking).

        You can also use this approach to examine the intermediate changes, because you execute the light query on the timestamp or the version column.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -