diff --git a/ExampleProject/ExampleProject.csproj b/ExampleProject/ExampleProject.csproj
index 76f2ce3..935acaf 100644
--- a/ExampleProject/ExampleProject.csproj
+++ b/ExampleProject/ExampleProject.csproj
@@ -7,6 +7,7 @@
+
diff --git a/ExampleProject/MockStartup.cs b/ExampleProject/MockStartup.cs
index 2b8d576..7cba8d3 100644
--- a/ExampleProject/MockStartup.cs
+++ b/ExampleProject/MockStartup.cs
@@ -1,24 +1,18 @@
-using Hangfire;
-using Microsoft.Extensions.DependencyInjection;
+using Microsoft.AspNetCore.Builder;
namespace ExampleProject;
public class MockStartup
{
- readonly IServiceCollection _serviceCollection;
+ readonly IApplicationBuilder _app;
- public MockStartup(IServiceCollection serviceCollection)
+ public MockStartup(IApplicationBuilder app)
{
- _serviceCollection = serviceCollection;
+ _app = app;
}
- public void Method1()
+ public void Startup()
{
- _serviceCollection.RegisterRecurringJobsFromExampleProject();
-
- RecurringJob.AddOrUpdate("RecurringJob1", "", x => x.Execute(), "0 0 * * *", new RecurringJobOptions
- {
- TimeZone = TimeZoneInfo.FindSystemTimeZoneById("UTC")
- });
+ _app.AddRecurringJobsFromExampleProject();
}
}
\ No newline at end of file
diff --git a/ExampleProject/Tests.cs b/ExampleProject/Tests.cs
index 53ba7ad..4008373 100644
--- a/ExampleProject/Tests.cs
+++ b/ExampleProject/Tests.cs
@@ -2,7 +2,7 @@
namespace ExampleProject;
-[RecurringJob("* * * *")]
+[RecurringJob]
public class RecurringJob1
{
public Task Execute()
@@ -11,7 +11,7 @@ public Task Execute()
}
}
-[RecurringJob("* * * *", "Priority")]
+[RecurringJob("* * * *")]
public class RecurringJob2
{
public void Execute()
@@ -20,8 +20,7 @@ public void Execute()
}
}
-[RecurringJob]
-[RecurringJob("*/5 * * * *", "GMT", "Priority", "DataRetention")]
+[RecurringJob("* * * *", "Priority")]
public class RecurringJob3
{
public void Execute()
@@ -30,7 +29,8 @@ public void Execute()
}
}
-[RecurringJob("* * * *")]
+[RecurringJob]
+[RecurringJob("*/5 * * * *", "GMT", "Priority", "DataRetention")]
public class RecurringJob4
{
public void Execute()
diff --git a/Scr/IeuanWalker.Hangfire.RecurringJob.Generator/RecuringJobGenerator.cs b/Scr/IeuanWalker.Hangfire.RecurringJob.Generator/RecuringJobGenerator.cs
index fa1098e..7ff4359 100644
--- a/Scr/IeuanWalker.Hangfire.RecurringJob.Generator/RecuringJobGenerator.cs
+++ b/Scr/IeuanWalker.Hangfire.RecurringJob.Generator/RecuringJobGenerator.cs
@@ -98,10 +98,11 @@ static void Generate(SourceProductionContext context, ImmutableArray
using Hangfire;
+using Microsoft.AspNetCore.Builder;
public static class RecurringJobRegistrationExtensions
{
- public static IApplicationBuilder RegisterRecurringJobsFrom").Append(assemblyName?.Sanitize(string.Empty) ?? "Assembly").Append(@"(this IApplicationBuilder app)
+ public static IApplicationBuilder AddRecurringJobsFrom").Append(assemblyName?.Sanitize(string.Empty) ?? "Assembly").Append(@"(this IApplicationBuilder app)
{
");
foreach (JobModel job in jobsToAdd.OrderBy(r => r.FullClassName))