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.4k stars 1.7k forks source link

Separate NetCore package from Hangfire.AspNetCore #1234

Open hikalkan opened 6 years ago

hikalkan commented 6 years ago

I want to create a Console application. I want to use Microsoft.Extensions.DependencyInjection package, so I use the power of DI in this console app.

Currently, the only option is to depend of the Hangfire.AspNetCore package package.

But the Hangfire.AspNetCore package depends on the Microsoft.AspNetCore.Hosting.Abstractions and Microsoft.AspNetCore.Http.Abstractions packages which is unnecessary for a console app.

As I see the source code, most of the code is independent from AspNet Core and you can create a separated package that only depends on the Microsoft.Extensions.DependencyInjection.Abstractions and Microsoft.Extensions.Logging.Abstractions. Then you can depend on this new package from the Hangfire.AspNetCore package.

tuscen commented 6 years ago

What's more is that now there's Microsoft.Extensions.Hosting package that allows you to use the same DI and other libraries from ASP.NET Core without depending on HTTP stuff. But Hangfire.AspNetCore uses IApplicationBuilder to start its servers. And that's a problem since there's no such thing in generic hosting.