Hangfire in .net core worker service

Hi,

i’m trying to setup Hangfire in a .net core worker service.
It is working, but i am wondering about where to register jobs, not sure if program.cs is the right place ?
Anyone have any experience with this?
We have many potential tasks to run.

this is what i got so far from program.cs:

IHost host = Host.CreateDefaultBuilder(args)
    .ConfigureServices(services =>
    {
        services.AddHangfire(x => x.UseSqlServerStorage(""));
        services.AddHangfireServer();
        services.AddApplicationInsightsTelemetryWorkerService(new ApplicationInsightsServiceOptions()
        {
            EnableAdaptiveSampling = false
        }).AddApplicationInsightsTelemetryProcessor<CustomTelemetryFilter>();
    })
    .ConfigureWebHostDefaults(builder =>
    {
        builder.Configure(app =>
        {
            // Schedule your Hangfire job here

            RecurringJob.AddOrUpdate<Test>("Test_ExecuteTask", job => job.ExecuteTest(), Cron.Minutely);

            // Hangfire dashboard options 

            DashboardOptions opt = new DashboardOptions();
            opt.DarkModeEnabled = true;
            opt.DashboardTitle = "Services Dashboard";
            opt.AppPath = null;
            app.UseRouting();

            app.UseHangfireDashboard("/hangfire", opt);
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapHangfireDashboard();
            });
        });
    })
    .Build();

host.Run();

We just register them in the IOC container during startup.

We are using ServiceStack so our implementation might look a little different but the idea should be exactly the same:

appHost.GetContainer().RegisterAutoWiredAs<SomeJob, ISomeJob>();