HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.43k stars 1.7k forks source link

Support for WebApplicationBuilder #2424

Open wobbet opened 4 months ago

wobbet commented 4 months ago

I am running a .NET Core 8 minimal Web API application and it has slightly odd behavior.

I am using

builder.Services.AddHangfire(config => config { ... });
builder.Services.AddHangfireServer((opts) => { ... });

Followed later by...

App = builder.Build();
App.UseHangfireDashboard();

After the call to App.Run() my Configure method is called again. Fortunately the calls to AddHangfire and AddHangfireServer don't do anything nasty and all is good. But still.

After doing some debugging it looks like this is caused by the call to UseHangfireDashboard. If I'm reading things correctly, this could be avoided if I could use builder.UserHangfireDashboard instead of the call on the application.

The problem is that builder.UseHangfireDashboard requires an IApplicationBuilder but my minimal API app is handed a WebApplicationBuilder which, for some unknown reason (thank you Microsoft), does not implement IApplicationBuilder.

Are there plans to support WebApplicationBuilder? If so, what is the timeline?

If not, is there any objection to my attempting to contribute code for that support? If you're okay with it, what should I know before starting to work on it? Do you have a link for what you expect from contributions?