ErikEJ / EFCorePowerTools

Entity Framework Core Power Tools - reverse engineering, migrations and model visualization in Visual Studio & CLI
MIT License
2.2k stars 299 forks source link

Change Solution & Reverse Engineer Uses Previous Database Connection #2647

Open chrisclarkecloudappointmentsconz opened 15 hours ago

chrisclarkecloudappointmentsconz commented 15 hours ago

We have various C# solutions running in Visual Studio 2022 and use Reverse Engineer in each of these.

I run Reverse Engineer in one solution and the 'Choose Database Connection' forms shows as; image

Which if fine and correlates with the value in efpt.config.json; image

I change the solution I'm working on to another, the efpt.config.json now shows as; image

But when I run Reverse Engineer in this solution I get; image

Reverse Engineer is picking up the database connection from the last time it was run and not using the efpt.config.json value.

To get it to work in the new solution I have to Add the database connection again. There's only one value in the Db Connections dropdown - the previously used one.

It's a UI bug that's frustrating and has caused errors - ran Reverse Engineer against the wrong database.

ErikEJ commented 6 hours ago

I think you are looking in the wrong places - the extension lists connections from Server Explorer, and the name of these are stored in the UiHint property in the config file. (You are showing me something else, not sure what).

All Server Explorer connections are shared for the same VS edition on your Windows profile.

There is a general option under Tools/Options to NOT store a value in the UiHint property (always stored by default)

To get it to work in the new solution I have to Add the database connection again.