I wish to delete a document which resides in a database. Document has some attachments which are located in a file system. Business logic first deletes everything in a database then removes the files. However, this procedure is often a part of a larger transaction and when rollback happens the document is restored but without the attachments. How to solve this?
I see two solutions for this:
- Delete files at the very end of transaction. In our framework this is not plausible solution I think.
- Store files in a database. This would work but it demands rewriting and retesting a whole lot.
Perhaps I’m missing some easier solution. Can you share your thoughts on this subject?
Thanks.
Beginning with Vista, NTFS offers true transactions with support for commit and rollback. Overview on Wikipedia and details here.