allow SQL Management to support non-tenant databases

This commit is contained in:
sbwalker
2026-01-19 11:36:27 -05:00
parent b0211b2e6e
commit 1a777b29e0
2 changed files with 129 additions and 121 deletions

View File

@@ -83,14 +83,14 @@ else
{ {
@if (_connection != "-") @if (_connection != "-")
{ {
@if (!string.IsNullOrEmpty(_tenant))
{
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="databasetype" HelpText="The database type" ResourceKey="DatabaseType">Type: </Label> <Label Class="col-sm-3" For="databasetype" HelpText="The database type" ResourceKey="DatabaseType">Type: </Label>
<div class="col-sm-9"> <div class="col-sm-9">
<input id="databasetype" class="form-control" @bind="@_databasetype" readonly /> <input id="databasetype" class="form-control" @bind="@_databasetype" readonly />
</div> </div>
</div> </div>
@if (!string.IsNullOrEmpty(_tenant))
{
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="tenant" HelpText="The database using this connection" ResourceKey="Tenant">Database: </Label> <Label Class="col-sm-3" For="tenant" HelpText="The database using this connection" ResourceKey="Tenant">Database: </Label>
<div class="col-sm-9"> <div class="col-sm-9">
@@ -203,6 +203,13 @@ else
// hack - there are 3 providers with SqlServerDatabase DBTypes - so we are choosing the last one in alphabetical order // hack - there are 3 providers with SqlServerDatabase DBTypes - so we are choosing the last one in alphabetical order
_databasetype = _databases.Where(item => item.DBType == tenant.DBType).OrderBy(item => item.Name).Last()?.Name; _databasetype = _databases.Where(item => item.DBType == tenant.DBType).OrderBy(item => item.Name).Last()?.Name;
} }
else
{
if (_connection.Contains(" ("))
{
_databasetype = _connection.Substring(_connection.LastIndexOf(" (") + 2).Replace(")", "");
}
}
} }
else else
{ {
@@ -273,6 +280,7 @@ else
} }
if (!string.IsNullOrEmpty(_name) && !string.IsNullOrEmpty(connectionstring)) if (!string.IsNullOrEmpty(_name) && !string.IsNullOrEmpty(connectionstring))
{ {
_name = _name + " (" + _databasetype +")";
var settings = new Dictionary<string, object>(); var settings = new Dictionary<string, object>();
settings.Add($"{SettingKeys.ConnectionStringsSection}:{_name}", connectionstring); settings.Add($"{SettingKeys.ConnectionStringsSection}:{_name}", connectionstring);
await SystemService.UpdateSystemInfoAsync(settings); await SystemService.UpdateSystemInfoAsync(settings);

View File

@@ -128,7 +128,7 @@ namespace Oqtane.Controllers
} }
break; break;
default: default:
_configManager.AddOrUpdateSetting(key, value, false); _configManager.AddOrUpdateSetting(key, value, true);
break; break;
} }
} }