private FileDbContext GetContext(FileAccess access) { if (_context == null) return _context = new FileDbContext(access); if (_context.FileAccess.HasFlag(access)) return _context; _context.Dispose(); return _context = new FileDbContext(access); }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects). _context?.Dispose(); } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. _context = null; disposedValue = true; } }