Modules reference
Overview of each feature module, its entry point, and current state.
| Module | Menu | Status | Notes |
|---|---|---|---|
| ConnectionManager | File → New Connection, side panel |
✅ | Full CRUD, DPAPI, test |
| ObjectExplorer | Side panel | ✅ | Lazy tree, multi-connection, context menu, disconnect |
| QueryEditor | File → New Query, dbl-click in tree |
✅ | AvalonEdit, format, autocomplete, execute, plans |
| ResultsGrid | Embedded in QueryEditor | ✅ (basic) | Export CSV/Excel/JSON TODO |
| SchemaCompare | Database → Schema Compare |
✅ | Table/view/proc/function diff + sync script |
| DataCompare | Database → Data Compare |
✅ | PK-based row diff + merge script |
| TableDesigner | Database → New Table |
✅ | Visual column editor + DDL; ALTER TODO |
| Profiler | Tools → Query Profiler |
✅ | Estimated + actual plan, operator stats |
| Debugger | Tools → Debugger |
✅ | Statement-level stepping · breakpoints · session state (v1.4) |
| Diagram | Tools → Database Diagram |
✅ (basic) | Grid layout, FK lines center-to-center |
| DataGenerator | Database → Data Generator |
✅ | Bogus-backed, preview/script/insert |
| Documenter | Database → Documenter |
✅ | HTML output to Documents\DBTeam-Docs\ |
ConnectionManager
ConnectionDialog— server, auth, credentials,Test+ConnectConnectionsPanel— list with double-click to connect, toolbar (reload/connect/delete), empty stateConnectionDialogViewModel.SaveAndConnectAsyncpublishesConnectionsChangedEventandConnectionOpenedEvent- Storage:
JsonConnectionStorein%AppData%\DBTeam\connections.json, passwords viaDpapiProtector
ObjectExplorer
ObjectExplorerViewModelsubscribes toConnectionOpenedEventand adds a root node per connection (dedup by Id)- Tree hierarchy: Server → Database → (Tables/Views/Procedures/Functions folders) → objects
- Lazy loading:
TreeNodeViewModel.Loaderfires on first expand - Icons:
KindToIconConvertermapsDbObjectKind→PackIconKind - Context menu: New Query Here · Script Object · Disconnect
- Right-click selects the hit item before opening the menu
QueryEditor
QueryEditorViewhosts AvalonEdit with TSQL syntax highlightingQueryEditorViewModelwrapsIQueryExecutionService- Shortcuts: F5 (execute), Ctrl+K (format via ScriptDom
Sql160ScriptGenerator), Ctrl+Space (completion) - Autocomplete:
SqlCompletionProvider+SqlCompletionItem- Static keywords
- Cached tables/views per (connection, db)
- Columns after
.— identifier is extracted from the text before the caret
Schema Compare
SchemaCompareEngine.CompareAsyncenumerates objects on both sides, scripts each, normalizes whitespace, and classifies:Identical | OnlyInSource | OnlyInTarget | DifferentGenerateSyncScript:OnlyInSource→ emits the source script (+GO)OnlyInTarget→ emitsDROP <kind> [schema].[name]Different(table) → emits a-- TODO: manual ALTER TABLE(column-level ALTER generation is TODO)Different(view/proc/func) →DROP+CREATE
Data Compare
- Loads both tables into
DataTableviaSqlServerQueryExecutionService-style connection - PK required — aborts otherwise
- Joins by concatenated PK string, classifies per row, emits
INSERT/UPDATE/DELETEunderBEGIN TRAN/COMMIT
Table Designer
ColumnRowViewModel— editable row in a DataGridBuildDdl()producesCREATE TABLE+CONSTRAINT PK_*from the rows- Move up/down via
ObservableCollection<T>.Move - Types: int/bigint/bit/decimal/varchar/nvarchar/date/datetime/uniqueidentifier/…
Profiler
EstimatedCommand→SET SHOWPLAN_XML ON, reads the plan XMLActualCommand→SET STATISTICS XML ONduring execution, captures the lastShowPlanXMLreader column- XML parsed with
XDocument, each<RelOp>becomes anOperatorStat(cost, estimated rows, and for actual: actual rows, logical reads from<RunTimeCountersPerThread>)
Diagram
- Tables laid out on a grid (
cols = ceil(sqrt(n)), 240x260 cells) - Each box: header bar with table name, up to 12 columns (🔑 for PK) listed
- FK lines are center-to-center (TODO: route between box borders)
- Canvas size 3000x3000 inside a ScrollViewer
Data Generator
DataGeneratorEngine.GenerateValue(col, faker)maps column to fake data:- Numeric types → Bogus
Random.* - Strings → name-based heuristic (email/phone/address/company/url/user/password/description) with length clamping
- Dates / Guids / blobs
- Numeric types → Bogus
InsertAsyncloops one INSERT per row with parameters and reports progress every 50 rowsPreviewAsynccaps at 50 rows for responsiveness
Documenter
HtmlDocumenter.BuildAsyncpulls tables → columns → indexes → FKs + views + procs + funcs- Renders a single self-contained HTML file with embedded CSS, sticky nav, pills for PK/IDENTITY/NOT NULL, 3-column list for views/procs/funcs
- Saves to
%USERPROFILE%\Documents\DBTeam-Docs\{db}-{yyyyMMdd-HHmmss}.htmland opens it via the default browser
Debugger
Functional since v1.4 via statement-level execution on a persistent connection:
TSqlStepExecutorparses the script with ScriptDom intoTSqlStatements(start offset, line, kind) and executes them one by one on a singleSqlConnectionsoDECLARE,SET,BEGIN TRANand temp tables persist across steps.- Breakpoints are stored as line numbers; Continue pauses before any step whose start line is flagged.
- Controls: Attach / Step Over / Continue / Stop / Restart / Detach.
- Session state panel shows live
@@ROWCOUNT,@@ERROR,@@TRANCOUNT,@@SPID, current DB, login after each step. PRINTandRAISERRORare captured viaSqlInfoMessageand displayed in the Messages tab with per-step timing.
Limitations: no interruption mid-statement, no step-into of stored procedures (would require full instrumentation — see docs/bmad/DESIGN-NOTES.md#e13).
Terminal
New in v1.5. Embeds an interactive shell process (pwsh, powershell, cmd, or any CLI) in a document tab. Input box with send-on-Enter, Quick snippets sidebar (Claude Code, gh, sqlcmd examples), start/stop/clear controls. Output is piped from the process’s stdout/stderr.
Administration
New in v1.5. 8 tabs: Databases (size, recovery model), Logins, Users, Roles, Permissions, Index fragmentation (with OK/REORGANIZE/REBUILD recommendation), Slow queries (top 50), Active sessions. Script generators for BACKUP DATABASE, RESTORE DATABASE, and index rebuild.