I have a Conversation class and it contains a List of Messages. I have provided the feature for the user to upload an attachment. I am using two separate Database for storage. Conversation class uses SqlServer and Messages are stored in MongoDb.
So when a user deletes his conversation, three tasks are being carried out:
- I have to soft delete his/her conversation from Conversation Database.
- I have to delete all the messages of that conversation from MessageDb in MongoDb.
- I have to remove all the attachment of that conversation from the cloud storage.
Since these three tasks are being carried out after one another,it takes much time to send the response to the user. I am considering whether to use Background Service or Azure Function for the deletion of messages and attachment from cloud storage.It would be much appreciated if you guys could provide me with a suggestion.