//-------------------------------------------------------------------------------------------------// protected void Application_Start(object sender, EventArgs e) { const String methodName = "Application_Start"; /* * Set the filepath for the log files */ string rootFilePath = HostingEnvironment.ApplicationPhysicalPath; string filePath = AppSetting.GetAppSetting(LabConsts.STRCFG_LogFilesPath); Logfile.SetFilePath(Path.Combine(rootFilePath, filePath)); /* * Set the logging level */ try { string logLevel = AppSetting.GetAppSetting(LabConsts.STRCFG_LogLevel); Logfile.Level level = (Logfile.Level)Enum.Parse(typeof(Logfile.Level), logLevel, true); Logfile.SetLevel(level); } catch { Logfile.SetLevel(Logfile.Level.Info); } Logfile.Write(String.Empty); Logfile.WriteCalled(STR_ClassName, methodName); /* * Get configuration properties */ Global.configProperties = new ConfigProperties(); Logfile.WriteCompleted(STR_ClassName, methodName); }
//---------------------------------------------------------------------------------------// public ServiceBrokerService() { const String methodName = "ServiceBrokerService"; /* * Check if initialisation needs to be done */ if (_experimentsDB == null) { Logfile.WriteCalled(logLevel, STR_ClassName, methodName); try { /* * Create instance of ExperimentsDB */ DBConnection dbConnection = Global.ConfigProperties.DbConnection; _experimentsDB = new ExperimentsDB(dbConnection); if (_experimentsDB == null) { throw new ArgumentNullException(ExperimentsDB.ClassName); } /* * Get the next experiment Id from the experiment database */ int nextExperimentId = _experimentsDB.GetNextExperimentId(); Logfile.Write(String.Format(STRLOG_NextExperimentId_arg, nextExperimentId.ToString())); /* * Create instance of LabServerAPI mapping */ _mapLabServerAPI = new Dictionary<string, LabServerAPI>(); } catch (Exception ex) { Logfile.WriteError(ex.Message); } Logfile.WriteCompleted(logLevel, STR_ClassName, methodName); } /* * Create local instances */ this.configProperties = Global.ConfigProperties; this.experimentsDB = _experimentsDB; this.mapLabServerAPI = _mapLabServerAPI; }