Api/Netina.Core/CoreConfig.cs

20 lines
547 B
C#
Raw Normal View History

using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Netina.Core.QuartzServices;
namespace Netina.Core;
public static class CoreConfig
2023-12-16 20:25:12 +03:30
{
public static async Task CoreInit(this IApplicationBuilder app)
{
var scopeFactory = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>();
using (var scope = scopeFactory.CreateScope())
{
var jobScheduler = scope.ServiceProvider.GetService<JobScheduler>();
jobScheduler.Start();
}
2023-12-16 20:25:12 +03:30
}
}