Need help on performing asynchronous operations
I have a folder structure:
- Parent
- 1st Child
- 2nd Child
- 3rd Child
- ...
There could be any number of child folders.
On deleting parent it should delete all its subcategories and each subcategory is asscoiated to different entities (e.g. permissions).
If a user deletes a parent folder with a large amount (e.g. 1000) sub categories it takes a long time, and therefore the UI hangs (as it deletes the subfolders before parents).
How can I do this asynchronously - allowing the user to continue working with the UI while the delete completes in the background? How would I notify them that the work has completed?
This开发者_开发百科 is a web (ASP.Net) application.
If it's not a necessity that deleted categories must be deleted instantly, a solution would be to just mark the categories for deletion in way that is fast and that you can distinguish between live and removed items. You could build a background process on the server that periodically scans and deletes all marked items for real. You could then schedule this process in times with less server load so that server performance remains unaffected during high traffic times.
精彩评论