IOptionsMonitor
is a singleton service that retrieves current option values at any time, which is especially useful in singleton dependencies.
IOptionsSnapshot
is a scoped service and provides a snapshot of the options at the time the IOptionsSnapshot<T>
object is constructed. Options snapshots are designed for use with transient and scoped dependencies.
Use
IOptions<T>
when you are not expecting your config values to
change. UseIOptionsSnaphot<T>
when you are expecting your values to
change but want it to be consistent for the entirety of a request. Use
IOptionsMonitor<T>
when you need real time values.