Scrutor icon indicating copy to clipboard operation
Scrutor copied to clipboard

Support for IOptions<T> ?

Open Marimax01 opened this issue 3 years ago • 3 comments

Hello,

I have a folder containing all my classes used to use dependency injection with IOptions<T> Microsoft doc

I would like it to be registered automatically as for my repositories is possible with your version currently? or does it require a feature?

Best regards

Marimax01 avatar Feb 20 '22 09:02 Marimax01

Just to chime in, I am in the same situation of looking at pre-existing DI scanning/discovery where the previous author implemented their own settings related approaches but I'm aiming to replace that with proper Options<T> support.

With Scrutor, I'm now unable to scan & register using the services.AddOptions<T> approach (or equivalents that work with a Type) so I'm finding that I'll have to move away from Scrutor for these needs.

So +1 for this support as a feature request for the future.

Also, I'm looking for ways to call AddOptions (or Configure) that accept a Type but yet let me work against the OptionsBuilder so that I can easily add the ValidateDataAnnotations and ValidateOnStart to the registered types.

bhehe avatar May 25 '22 19:05 bhehe

Same situation. Would be great to add AddOptions support.

slootsky-oleg avatar Jul 14 '22 18:07 slootsky-oleg

I managed to add this very basic support for IOptions<T> in my own Autowiring library here. I'm sure it's possible to add support for this in Scrutor.

Tim-Maes avatar Oct 23 '23 07:10 Tim-Maes