private void Dispose(bool disposing) { if (disposing) { if (_tempFileAttachments != null) { _tempFileAttachments.Dispose(); _tempFileAttachments = null; } } }
TempFileCollection IFilesStorageRepository.SaveTempFile(string fileContents, string fileName) { var tempCollection = new TempFileCollection(); try { using (var stream = tempCollection.AddNewTempFile(fileName)) { using (var writer = new StreamWriter(stream)) { writer.Write(fileContents); } } } catch { tempCollection.Dispose(); throw; } return(tempCollection); }