public static void Main(string[] args) { var kernel = NinjectWebKernel.GetKernel(); var x = kernel.GetBindings(typeof(DataContext)).FirstOrDefault(); kernel.RemoveBinding(x); kernel.Bind <DataContext>().ToSelf().InSingletonScope(); // we need to use a single dbcontext var logger = kernel.Get <ILogger>(); // hacks because of error with Entity Framework. // This forces the dmzconnection to use MySql. new DataContext(); var gpsEncryptService = new GPSEncryptService(logger); logger.Debug("-------- DMZ GPS Encrypt STARTED --------"); try { logger.Debug("DoGPSEncrypt started"); Console.WriteLine("DoGPSEncrypt"); gpsEncryptService.DoGPSEncrypt(); } catch (Exception ex) { logger.Error($"Error during encrypting geocoordinates on DMZ", ex); logger.LogForAdmin("Fejl under kryptering af geo koodinater i DMZ."); throw; } logger.Debug("-------- DMZ GPS Encrypt ENDED --------"); }
static void Main(string[] args) { // Checks if any files need to be generated and transfered to the payroll system daily at kl 16:00 ILogger _logger = NinjectWebKernel.GetKernel().Get <ILogger>(); _logger.Debug($"-------- FILE GENERATIONS STARTED --------"); var service = NinjectWebKernel.GetKernel().Get <FileGenerationService>(); service.RunFileGenerationService(); _logger.Debug($"-------- FILE GENERATION FINISHED --------"); }