When do you use IOptionsMonitor explained

IOptionsMonitor is a part of the IOptions provided in ASP.NET Core. It returns the "CurrentValue" and notifications when options change.

IOptionsMonitor is an interface provided as a part of the IOptions framework provided in ASP.NET Core.

There are three interfaces provided by this namespace as a part of configuring TOptions instances.

  1. IOptions
  2. IOptionsSnapshot and
  3. IOptionsMonitor

IOptionsMonitor returns the “CurrentValue” of the options along with notifications when the options change.

It is created as a SingletonService which can be injected into any service. It also supports updated options when the configuration changes after app starts. It also supports “named” options


Buy Me A Coffee

Found this article helpful? Please consider supporting!

Ram
Ram

I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity. You can connect with me on Medium, Twitter or LinkedIn.

Leave a Reply

Your email address will not be published. Required fields are marked *