protected override void Dispose(bool disposing) { if (disposing) { if (_fileStream.IsValueCreated) { _fileStream.Value.Dispose(); } _context.Dispose(); _fileStream = null; _context = null; if (_transactionScope != null) { _transactionScope.Dispose(); _transactionScope = null; } } }
public FileStreamWrapper(int id, IDependencyResolver dependencyResolver) { _id = id; _context = dependencyResolver.Get <ProjectFilesContext>(); _fileStream = new Lazy <Stream>(GetFileFromDb); }