コード例 #1
0
        private IEnumerable <Notification> When(StartJobs message)
        {
            while (_pendingJobs.Count > 0)
            {
                var pendingJob = _pendingJobs.Dequeue();
                _jobs.Add(pendingJob);

                yield return(pendingJob.StartJob());
            }
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            // Build the host
            var host = CreateHostBuilder(args).Build();

            // Get the database service from the host
            using var scope = host.Services.CreateScope();
            var services = scope.ServiceProvider;
            var context  = services.GetRequiredService <ApplicationDbContext>();

            // Start all jobs
            StartJobs.StartAllJobs(context).GetAwaiter().GetResult();

            // Run host
            host.Run();
        }