0

As described in Microsoft guides, I'm using services.Configure() method to create a config of T type from app configuration and to put it into DI container. My implementation of HttpClient receives IOptionsMonitor and httpClient through its constructor.

Now I need to receive a set of credentials from db, and make some work in the loop. So, on the 1st iteration, I need to put 1st credentials into T instance (I can access it, receiving from DIl, 2nd to 2nd, as so on.

I expected OnChange delegate to be fired when I change the T object received through IOptionsMonitor from DI. But OnChange is fired only when I change app settings file only, not the object in DI container.

So, the question is - is it a right way to change Options T in DI container and to fire OnChange delegate of IOptionsMonitor?

Laser42
  • 646
  • 2
  • 7
  • 24

0 Answers0