private void EnsureConnectionSet() { if (_connection == null) throw new InvalidOperationException("Connection is not assigned."); }