public void ConnectTo(DbToolDatabase connectionData) { if (IsConnected) { throw new UserException(ExceptionType.AlreadyConnected); } _database = connectionData; _dbContext = _dbConnectionFactory.CreateDbContext(connectionData); }
public void Disconnect() { if (IsConnected) { _dbContext.DbConnection.Close(); _dbContext.DbConnection.Dispose(); _dbContext = null; _database = null; } }