tomahg / Gulla.Episerver.SqlStudio

An Optimizely/Episerver addon that let you run SQL queries from within the admin interface.
10 stars 0 forks source link

Make it possible to select connection string from user interface #1

Closed tomahg closed 3 years ago

tomahg commented 3 years ago

If there are more than one connectionstring in ConfigurationManager.ConnectionStrings a dropdownlist (or any other suitable way of changing connectionstring) should be shown to the user. A typical use case is having both CMS and Commerce databases, and wanting to query both.

A postback should probably be done when the connectionstring is changed, at least the code updating autocomplete/intellisense must be run against the newly selected database.

The code updating autocomplete/intellisense is this part in SqlStudioController.cs:

model.SavedQueries = _sqlService.GetTableNames().Contains("SqlQueries") ? _queryLoader.GetQueries().ToList() : Enumerable.Empty<SqlQueryCategory>();
model.SqlAutoCompleteMetadata = _sqlService.GetMetaData();
model.SqlTableNameMap = _sqlService.TableNameMap();
tomahg commented 3 years ago

Fixed in https://github.com/tomahg/Gulla.Episerver.SqlStudio/pull/2