Is building the config in the constructor the best place so the work is implicit:
protected override void OnStart(string[] args) { // The first call for an instance, so the object is created & data is loaded ConfigSingleton MyConfig = ConfigSingleton.GetInstance;
protected override void OnStart(string[] args) { // The first call for an instance, so the object is created & data is loaded ConfigSingleton MyConfig = ConfigSingleton.GetInstance; // Create object that checks db for data to process; relies on config Poller = new Poller(); Poller.Start(); }}
protected override void OnStart(string[] args)
{
ConfigSingleton MyConfig = ConfigSingleton.GetInstance;
MyConfig.getConfig(); // Explicit call to get config from db
// Create object that checks db for data to process; relies on config
Poller = new Poller();
Poller.Start();
}
Should the work to check for the config tables be done by a separate, presumably static, class:
protected override void OnStart(string[] args) { if (!DBChecker.isTableReady()) { DBChecker.BuildTables(); }
protected override void OnStart(string[] args) { if (!DBChecker.isTableReady()) { DBChecker.BuildTables(); } ConfigSingleton MyConfig = ConfigSingleton.GetInstance; MyConfig.getConfig(); // Create object that checks db for data to process; relies on config Poller = new Poller(); Poller.Start(); }}
// Inside this function, a call is made to BusinessLayer.GetList1()
MyController = new Controller(FirstParam);
MyController.Start();
// Yet here, a similar version is called first and then the result is passed as a parameter
List<Objects> MyList2 = BusinessLayer.GetList2();
MySender = new Sender(SecondParam, MyList2);
MySender.Start();