Hangfire icon indicating copy to clipboard operation
Hangfire copied to clipboard

Changed service registration from Transient to Singleton to allow consume it

Open krzysiek-b opened this issue 3 years ago • 2 comments

Seems like it makes more sense to register the service as Singleton to allow any consumer inject it into its classes rather than having this transient and not being able to consume it at all.

krzysiek-b avatar Jul 22 '22 15:07 krzysiek-b

Unfortunately this will break existing code, where multiple background job servers are started in the same application that's an existing use case. Different applications, different environments, as far as I remember BackgroundJobServerHostedService class is public so you can use your own registrations directly instead of calling the AddHangfireServer method.

odinserj avatar Aug 01 '22 05:08 odinserj

@odinserj why not also close PR since it will never be merged because of breaking changes?

domagojmedo avatar Aug 19 '22 12:08 domagojmedo