News for hackers. Stuff that matters.
Re:.NET 5.0 by 0xcoffee on Tuesday November 10, 2020 @03:33PM (#25051514)
I am aware of this, but like many other, I find the IOptions<T> a bad abstraction.

This blog has similar thoughts: https://rimdev.io/strongly-typed-configuration-settings-in-a...

or this blog: https://adamstorr.azurewebsites.net/blog/beyond-basics-aspne...

Or simply google 'asp net strongly typed configuration' and notice everyone seems to be reaching similar conclusions and building their own things.

Just load the setting yourself and register it as a singleton.

Re:.NET 5.0 by davidfowl on Tuesday November 10, 2020 @10:37PM (#25055251)
Options are a very misunderstood abstraction that we have done a poor job explaining. Those blog posts are simplistic and don't explain what you gain and lose by using the options abstraction.
Re:.NET 5.0 by zvrba on Wednesday November 11, 2020 @01:05AM (#25055921)
> that we have done a poor job explaining

Yes, indeed you have. I've tried to both skim and read the "introductory" documentation for `Options<T>` and the only gain I could figure out is monitoring + refresh. I still have no idea how to use it though, so I don't.

Re:.NET 5.0 by macca321 on Tuesday November 10, 2020 @04:04PM (#25051894)
I don't like it either, but one advantage is that the settings can be live updated when the config files change
Re:.NET 5.0 by nullsense on Tuesday November 10, 2020 @10:17PM (#25055135)
The interface just doesn't bother me. I make reasonably good use of the hierarchical config providers including some custom ones. Plus it supports actually being able to live update the config values.

Meh, seems like just an interface to me.

Re:.NET 5.0 by oaiey on Tuesday November 10, 2020 @05:33PM (#25052973)
Do not use Options. Use regular poco bound against Configuration sections like the rest of us :)