Fix Multiple Bug on Database & EventAggregator

To begin the week, I faced database bug without any error prompted. When updating my data on existing database, UI/ViewModel seems like it saved the latest changes. But when data grid list is refreshed, the edited data will be removed. After perform an integration test and run debug mode, it appears to be attribute is not sync with correct variable. Hence, causing the new set of data are not able to update. Beside that, old set of data is removed due to implementation to remove existing set of data after they are edited.

Next, when two or more user is using the application, concurrency situation will occurs. Hence, a test is performed to solve this situation. Updating data list might fail whenever the data on database and ViewModel selected data is differ. After test is done, I implemented a dialog box to notify the user when their data changes failed. Despite that, context is not reload to latest data list, thus, the error dialog kept prompt as I try to update new data. Therefore, I implemented a reload function in repository class to make sure latest data is reloaded whenever data update is failed through error handling.

Other than that, I found a bug in my implementation, everything works fine until I close the window and reopen it. By doing that, It would prompt error of “Invalid SelectedId” or “Object reference not set to an instance of an object” when I try to edit/delete selected data. It appears to be an issue of event aggregator been subscribed twice. By adding a dispose( ) function and Unsubscribe event upon closing the window, the issue is solved.

Leave a Reply