Persist initial database name on saved connection updates (#358)#360
Merged
Conversation
PR #359 added an optional "Initial database" field to the Connect dialog and was meant to persist it on ServerConnection. BuildServerConnection set it and ApplySavedConnection restored it, but ConnectionStore.AddOrUpdate dropped it: the update branch copies fields onto the existing record one by one and never assigned DatabaseName. So the field was only saved on the very first connect to a brand-new server (the add branch persists the whole object) and silently discarded on every reconnect to a known server. That is exactly the reopened follow-up on #358: reconnecting to a previously used server left the Initial database field empty even though server name and credentials were remembered. It also meant a saved server could never have its initial database changed. Assign existing.DatabaseName from the incoming connection in the update branch so the field round-trips on every save. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the reopened follow-up on #358: when reconnecting to a previously used server, the new Initial database field came back empty even though server name and credentials were remembered.
Root cause
#359 added the field and was meant to persist it on
ServerConnection—BuildServerConnectionsets it andApplySavedConnectionrestores it. ButConnectionStore.AddOrUpdatesilently dropped it: the update branch copies fields onto the existing record one at a time and never assignedDatabaseName. So the field was only saved on the first connect to a brand-new server (the add branch persists the whole object) and discarded on every reconnect to a known server.Benjamin's Azure/JIT server already existed in his
connections.jsonfrom before #359, so his connect always took the update path — which is why the field never stuck for him. The same bug also meant a saved server could never have its initial database changed.Fix
One line in the update branch of
AddOrUpdate:The restore side (
ApplySavedConnection) already pre-fills the field, so this closes the loop.Test plan
dotnet build src/PlanViewer.Appsucceeds🤖 Generated with Claude Code