Api/Netina.Core/CoreConfig.cs

21 lines
707 B
C#

using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Netina.Core.QuartzServices;
namespace Netina.Core;
public static class CoreConfig
{
public static async Task CoreInit(this IApplicationBuilder app)
{
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("NjA1NkAzMjM2MkUzMTJFMzliSzVTQlJKN0NLVzNVOFVKSlErcVEzYW9PSkZ2dUhicHliVjkrMncxdHpRPQ==");
var scopeFactory = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>();
using (var scope = scopeFactory.CreateScope())
{
var jobScheduler = scope.ServiceProvider.GetService<JobScheduler>();
jobScheduler.Start();
}
}
}