
done: + master.sql as resource + implemented incremental database changes also for Master + dbUp sql script variables implemented + improved database handling and creation code + simpified database creation + almost all Database and Tenant creation moved to DatabaseManager.cs (rest code marked with TODO) + Unattended install of master can be performed by settings in appsettings.json + Improved IsInstalled checking + Removed DBSchema field from Tenant + Default database and site creation moved to Program.Main
52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Hosting;
|
|
// DO NOT REMOVE - needed for client-side Blazor
|
|
using Microsoft.AspNetCore.Blazor.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.AspNetCore;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Oqtane.Infrastructure;
|
|
|
|
namespace Oqtane.Server
|
|
{
|
|
public class Program
|
|
{
|
|
#if DEBUG || RELEASE
|
|
public static void Main(string[] args)
|
|
{
|
|
var host = CreateHostBuilder(args).Build();
|
|
using (var serviceScope = host.Services.GetRequiredService<IServiceScopeFactory>().CreateScope())
|
|
{
|
|
var manager = serviceScope.ServiceProvider.GetService<DatabaseManager>();
|
|
manager.StartupMigration();
|
|
}
|
|
//DatabaseManager.StartupMigration();
|
|
host.Run();
|
|
}
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
Host.CreateDefaultBuilder(args)
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
{
|
|
webBuilder.UseStartup<Startup>();
|
|
});
|
|
#endif
|
|
|
|
#if WASM
|
|
public static void Main(string[] args)
|
|
{
|
|
BuildWebHost(args).Run();
|
|
}
|
|
|
|
public static IWebHost BuildWebHost(string[] args) =>
|
|
WebHost.CreateDefaultBuilder(args)
|
|
.UseConfiguration(new ConfigurationBuilder()
|
|
.AddCommandLine(args)
|
|
.Build())
|
|
.UseStartup<Startup>()
|
|
.Build();
|
|
#endif
|
|
|
|
}
|
|
}
|