示例#1
0
        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);
        }