Ejemplo n.º 1
0
        public void DeleteDirectory(string directoryPath)
        {
            ITransaction transaction = ObtainCurrentTransaction();

            if (transaction != null)
            {
                // We're participating in a transaction, use the TransactionalFileWriter to delete the directory.
                TransactionalFileWriter fileWriter = GetFileWriterForTransaction(transaction);
                transaction.Enlist(fileWriter);
                fileWriter.DeleteDirectory(directoryPath);
            }
            else
            {
                // No transaction, just delete the directory.
                Directory.Delete(directoryPath, true);
            }
        }