Home

Connection-specific appsettings.json not updated in shadow folder when I switch connections

I am experiencing what appears to be a bug. I am LINQPad 7 and Peter Butzhammer's Entity Framework 6 driver. I am specifying a different appsettings.json in the connection properties of each of my connections. These settings files are used to determine the connection string on production servers, allowing me to reuse my configuration files of my various production sites in LINQPad, rather than having to specify connection string in each connection.

Usually, when I switch the connection through the drop-down menu in a query, everything works as expected: The appropriate appsettings.json is copied to the shadow folder, and the connection string is set appropriately. However, in some cases this does not happen. I noticed that I was sometimes getting unexpected results and eventually realized that the connection string was not being updated. I know that the connection change "registers", because the orange highlight changes when I switch from production to non-production databases. However, the connection string remains the same as the old connection and my queries are made against the old database (which is extremely dangerous when my scripts make updates to the database). I used Environment.CurrentDirectory.Dump() to get the shadow folder and verified that the appsettings.json file was not being updated to the one associated with the newly selected connection. Strangely, Util.CurrentQuery.GetConnectionInfo().AppConfigPath.Dump() points to the correct appsettings.json file for the new connection.

Changing the connection again usually fixes the problem, but not always.

I don't know if the problem is with LINQPad, or with the EF6 driver. Any ideas?

Comments

Sign In or Register to comment.