I have an app where user can work on a file downloaded from database. When file is downloaded, in database query is run setting "owner" value in corresponding table row. As a result other users see that file is owned by somebody else and can only read from it, not modify it. After work session user saves file to database and sets "owner" to none allowing other users access file. This works fine till app crashes or there is power shortage or some error in system that terminates app leaving database entries "reserved". In case of crash I can follow this approach : WPF global exception handler and try to connect to database to "free" all files reserved by user, but in other cases as my research has shown there is no way how to know that program failure has occured and I should "free" database so other users can access previously reserved files. Is this way how to show other users that something in database is not awailable for editing is in general bad design or there are solutions to this type of a problem?
Asked
Active
Viewed 50 times
0
-
If is possible I suggest to add a DownloadDateTime to your records and if a certain amount of time passes, free automatically the records. It is not just the crashes here. What if the user downalods and then goes on vacation? – Steve Feb 28 '19 at 11:01
-
@Steve Yes, it is good idea, however if user is still working on a file, it would interrupt his work and user would lose ability to save back to database. – niks Feb 28 '19 at 11:15