Task IHostedService.StartAsync(CancellationToken cancellationToken)
        {
            EnvironmentName.AppendLine("XXXService: StartAsync");
            System.Console.WriteLine("XXXService: StartAsync");
            this.m_Run = true;
            Task t = RunDbSync();

            return(System.Threading.Tasks.Task.CompletedTask);
        }
        Task IHostedService.StopAsync(CancellationToken cancellationToken)
        {
            EnvironmentName.AppendLine("XXXService: StopAsync");
            System.Console.WriteLine("XXXService: StopAsync");

            this.m_Run = false;

            return(System.Threading.Tasks.Task.Delay(2000));
        }
 public async Task RunDbSync()
 {
     while (this.m_Run)
     {
         EnvironmentName.AppendLine("XXXService: Tick");
         System.Console.WriteLine("XXXService: Tick");
         await System.Threading.Tasks.Task.Delay(1000);
     }
 }