Mid ASP.NET Core

Using Options pattern (IOptions, IOptionsSnapshot,?

IOptionsMonitor)

  • IOptions<T>: For singleton/config services.
  • IOptionsSnapshot<T>: Scoped; updates per request.
  • IOptionsMonitor<T>: Singleton; can react to config changes.

services.Configure<MySettings>(Configuration.GetSection("MySettings"

));

More from ASP.NET Core Tutorial

All questions for this course