Difference between IOptionsMonitor vs. IOptionsSnapshot

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. Use IOptionsSnaphot<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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)