# Refactor: extract repository SELECT column-list constants

**Task**: AZ-379_refactor_repo_select_columnlist
**Name**: One ColumnList per repository
**Description**: Extract a per-repository `private const string ColumnList` and interpolate it into each SELECT.
**Complexity**: 2 points
**Dependencies**: None
**Component**: DataAccess
**Tracker**: AZ-379
**Epic**: AZ-350

## Problem

`SatelliteProvider.DataAccess/Repositories/TileRepository.cs` contains the same `id, tile_zoom as TileZoom, tile_x as TileX, ...` column list in 4 SELECTs; `RegionRepository.cs` has 2 such SELECTs; `RouteRepository.cs` similar. Every new column must be added in lockstep across all SELECTs; easy to drift.

## Outcome

- Each repository defines `private const string ColumnList = "..."` once and reuses it across all SELECTs.
- Generated SQL is byte-for-byte identical.
- 37 unit + 5 smoke tests stay green.

## Scope

### Included
- Per repository: extract the column list once.
- Replace each SELECT with `$"SELECT {ColumnList} FROM <table> WHERE ..."`.

### Excluded
- Pulling in `Dapper.Contrib` or a micro-ORM.
- Renaming or reordering columns.

## Acceptance Criteria

**AC-1: One ColumnList per repository**
Given the post-refactor source
When each repository is inspected
Then it declares `ColumnList` once and references it from every SELECT.

**AC-2: SQL byte-identical**
Given the post-refactor code
When SELECT statements are extracted (e.g., via test interception or Dapper logging)
Then the generated SQL matches the pre-refactor output.

**AC-3: Tests stay green**
Given the post-refactor build
When `scripts/run-tests.sh --smoke` runs
Then all 37 unit + 5 smoke scenarios pass.

## Constraints

- No new dependencies.

## Risks & Mitigation

**Risk 1: interpolation introduces an injection vector**
- *Risk*: `$"..."` interpolation looks like a SQL-injection foot-gun.
- *Mitigation*: `ColumnList` is a `const` defined in source; not user input. Standard Dapper parameterization stays for actual values.

Full change entry: `_docs/04_refactoring/03-code-quality-refactoring/list-of-changes.md` (C26).
