install/upgrade refactoring to consolidate all use cases and implement IInstallable interface for modules, moved tenant creation to site management UI, fixed z-order issues in Blazor theme, enhanced JS Interop methods to support integrity and crossorigin
This commit is contained in:
@ -10,18 +10,21 @@ namespace Oqtane.Repository
|
||||
{
|
||||
public class SqlRepository : ISqlRepository
|
||||
{
|
||||
private readonly ITenantRepository _tenants;
|
||||
|
||||
public SqlRepository(ITenantRepository tenants)
|
||||
public void ExecuteScript(Tenant tenant, string script)
|
||||
{
|
||||
_tenants = tenants;
|
||||
// execute script in curent tenant
|
||||
foreach (string query in script.Split("GO", StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
ExecuteNonQuery(tenant, query);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ExecuteEmbeddedScript(Assembly assembly, string filename)
|
||||
public bool ExecuteScript(Tenant tenant, Assembly assembly, string filename)
|
||||
{
|
||||
// script must be included as an Embedded Resource within an assembly
|
||||
bool success = true;
|
||||
string uninstallScript = "";
|
||||
string script = "";
|
||||
|
||||
if (assembly != null)
|
||||
{
|
||||
@ -33,39 +36,27 @@ namespace Oqtane.Repository
|
||||
{
|
||||
using (var reader = new StreamReader(resourceStream))
|
||||
{
|
||||
uninstallScript = reader.ReadToEnd();
|
||||
script = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(uninstallScript))
|
||||
if (!string.IsNullOrEmpty(script))
|
||||
{
|
||||
foreach (Tenant tenant in _tenants.GetTenants())
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
ExecuteScript(tenant, uninstallScript);
|
||||
}
|
||||
catch
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
ExecuteScript(tenant, script);
|
||||
}
|
||||
catch
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public void ExecuteScript(Tenant tenant, string script)
|
||||
{
|
||||
// execute script in curent tenant
|
||||
foreach (string query in script.Split("GO", StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
ExecuteNonQuery(tenant, query);
|
||||
}
|
||||
}
|
||||
|
||||
public int ExecuteNonQuery(Tenant tenant, string query)
|
||||
{
|
||||
SqlConnection conn = new SqlConnection(FormatConnectionString(tenant.DBConnectionString));
|
||||
|
Reference in New Issue
Block a user