I've done this:
services.Configure<ApplicationSettings>(_configuration.GetSection("ApplicationSettings"));
I assumed that would allow me to inject ApplicationSettings
, but apparently not.
I could just do GetSection(...)
and register it as a singleton, but then what's the point of .Configure
?
The msdn doc says "Registers a configuration instance that TOptions will bind against, and updates the options when the configuration changes."
It's unclear how to set up the pattern to use the config as DI in my application though.
This is the SO question I was trying to implement:
How do I transform appsettings.json in a .NET Core MVC project?