示例#1
0
        public void DeleteFile(string filePath)
        {
            ITransaction transaction = ObtainCurrentTransaction();

            if (transaction != null)
            {
                // We're participating in a transaction, use the TransactionalFileWriter to delete the file.
                TransactionalFileWriter fileWriter = GetFileWriterForTransaction(transaction);
                transaction.Enlist(fileWriter);
                fileWriter.DeleteFile(filePath);
            }
            else
            {
                // No transaction, just delete the file.
                File.Delete(filePath);
            }
        }