mirror of
https://github.com/Myxelium/Lunaris2.0.git
synced 2026-07-08 05:45:10 +00:00
Add scheduler
This commit is contained in:
26
Bot/Registration/SchedulerRegistration.cs
Normal file
26
Bot/Registration/SchedulerRegistration.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Hangfire;
|
||||
using Hangfire.AspNetCore;
|
||||
using Lunaris2.Handler.Scheduler;
|
||||
|
||||
namespace Lunaris2.Registration;
|
||||
|
||||
public static class SchedulerRegistration
|
||||
{
|
||||
public static IServiceCollection AddScheduler(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddHangfire((serviceProvider, config) =>
|
||||
{
|
||||
config.SetDataCompatibilityLevel(CompatibilityLevel.Version_180)
|
||||
.UseSimpleAssemblyNameTypeSerializer();
|
||||
|
||||
config.UseSqlServerStorage(configuration.GetValue<string>("HangfireConnectionString"));
|
||||
});
|
||||
|
||||
services.AddHangfireServer();
|
||||
|
||||
// Register your handler
|
||||
// services.AddScoped<ScheduleMessageHandler>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user