Allow custom configuration via Options pattern
See original GitHub issueIs your feature request related to a problem? Please describe.
“I’m always frustrated when” I cannot access IServiceProvider
in the configure
action of AddQuartz
.
Describe the solution you’d like
AddQuartz
should have an overload like AddQuartz(this IServiceCollection serviceCollection, Action<IServiceProvider, IServiceCollectionQuartzConfigurator>? configure = null)
similar to eg. AddContext
.
Describe alternatives you’ve considered
Alternatively Quartz could expose an options interface, and I could configure with eg. IConfigureOptions<QuartzOptions>
. For example AddCors
does this with CorsOptions
. One can use IConfigureOptions<CorsOptions>
to configure cors and access IServiceProvider
.
As a workaround I can manually bootstrap the dependencies I’d like to access in AddQuartz
.
Additional context My use cases are similar to Andrew Lock’s described in this blog post. Hope you find some inspiration there.
Many thanks!
EDIT: To be clear, this is a minor improvement on the configuration interface as feedback was requested.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (6 by maintainers)
Top GitHub Comments
@lahma Looks great for my needs, thanks!
So I’ve done changes required to achieve @kevinchalet 's proposed idea with PR https://github.com/quartznet/quartznet/pull/978 . Hopefully this is nor more in line with expectations from options pattern and allows to do the Configure.