From 52fd16d59f1270c7540523cdcf8ad3f3271c0c49 Mon Sep 17 00:00:00 2001 From: "Eric J. Smith" Date: Fri, 26 Jul 2024 10:29:12 -0500 Subject: [PATCH] Don't require name on typed jobs --- src/Foundatio.Extensions.Hosting/Jobs/JobHostExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Foundatio.Extensions.Hosting/Jobs/JobHostExtensions.cs b/src/Foundatio.Extensions.Hosting/Jobs/JobHostExtensions.cs index 5b7f9b14..ef293686 100644 --- a/src/Foundatio.Extensions.Hosting/Jobs/JobHostExtensions.cs +++ b/src/Foundatio.Extensions.Hosting/Jobs/JobHostExtensions.cs @@ -78,11 +78,11 @@ public static IServiceCollection AddCronJob(this IServiceCollection services, Ac return services.AddCronJob(jobOptionsBuilder.Target); } - public static IServiceCollection AddCronJob(this IServiceCollection services, string name, string cronSchedule, Action configureJobOptions = null) where T : class, IJob + public static IServiceCollection AddCronJob(this IServiceCollection services, string cronSchedule, Action configureJobOptions = null) where T : class, IJob { services.AddTransient(); var jobOptionsBuilder = new ScheduledJobOptionsBuilder(); - jobOptionsBuilder.Name(name).CronSchedule(cronSchedule).JobFactory(sp => sp.GetRequiredService()); + jobOptionsBuilder.Name(typeof(T).FullName).CronSchedule(cronSchedule).JobFactory(sp => sp.GetRequiredService()); configureJobOptions?.Invoke(jobOptionsBuilder); return services.AddCronJob(jobOptionsBuilder.Target); }