//Warn up the database and show some warm messages while Synchronizeing the Database and Web.config file. private static void WarmUpDatabaseAndSychWebConfiguration() { var WarmUpMessages = new Pyro.Common.ProductText.PyroWarmUpMessages(); if (!Console.IsOutputRedirected) { WarmUpMessages.Start("Pyro FHIR Server", $"Version: {System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(Pyro.Common.Global.GlobalProperties).Assembly.Location).ProductVersion}"); } //Check the database migrations are up-to-date with the application Pyro.Common.Logging.Logger.Log.Info("Running server start-up process to check the Database Migrations are run."); if (!App_Start.StartupPyroDatabaseMigrationCheck.RunTask(HttpConfiguration)) { if (!Console.IsOutputRedirected) { WarmUpMessages.Stop(); Console.Clear(); } string Message = "Database upgrade is required. Please consider running the Pyro.DbManager to upgrade your database."; Console.WriteLine(); Console.WriteLine("Database upgrade is required."); Console.WriteLine(); Console.WriteLine("Please consider running the Pyro.DbManager to upgrade your database."); Console.WriteLine(); Console.WriteLine("The application must now exit, press any key."); Console.ReadKey(); Pyro.Common.Logging.Logger.Log.Fatal(Message); throw new Exception(Message); } //Synch the Web Configuration file Pyro.Common.Logging.Logger.Log.Info("Running server start-up process to synchronise the web.config file with the database table ServiceConfiguration."); App_Start.StartupPyroConfirgrationSynch.RunTask(HttpConfiguration); //Check seeded FHIR Resource and update if required Pyro.Common.Logging.Logger.Log.Info("Running server start-up process to seed any reference FHIR resources."); App_Start.StarupPyroResourceSeeding.RunTask(HttpConfiguration); //Check for any FHIR task to process on start-up //NOTE: This Task runs asynchronous, it does not stop the server from starting. Pyro.Common.Logging.Logger.Log.Info("Running server start-up process to manage pending FHIR Tasks."); App_Start.StarupPyroTaskRunner.RunTask(HttpConfiguration); if (!Console.IsOutputRedirected) { WarmUpMessages.Stop(); Console.Clear(); } }
public void Start() { // write code here that runs when the Windows Service starts up. Console.Clear(); Console.ForegroundColor = ConsoleColor.DarkYellow; Console.Write(Common.ProductText.PyroText.PyroTextLogo("Pyro Backburner", "MyVersion")); Console.ResetColor(); ConsoleSupport.DateTimeStampWriteLine("Starting..."); var WarmUpMessages = new Pyro.Common.ProductText.PyroWarmUpMessages(); WarmUpMessages.Start("Pyro Backburner", $"Version: {System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(Pyro.Common.Global.GlobalProperties).Assembly.Location).ProductVersion}"); Container = new Container(); App_Start.SimpleInjectorWebApiInitializer.Initialize(Container); WarmUpMessages.Stop(); Console.ForegroundColor = ConsoleColor.Cyan; GetPyroServerConnectionUrl(); ConsoleSupport.DateTimeStampWriteLine("Database schema loaded..."); _timer = new Timer(InitilizeHub, null, _StartupDelay, _StartupDelay); }