IOptionsSnapshot<T>
The options interface registered as scoped, recomputed once per scope, so in a web app an edited setting appears on the next request.
In more detail
Each scope gets values bound from the configuration as it stood when the scope began. Because it is scoped, it cannot be injected into a singleton; scope validation catches that.
Related terms
- IOptions<T> — The options interface that gives a singleton view of an options class, bound once and never recomputed for the life of the process.
- IOptionsMonitor<T> — The singleton options interface whose CurrentValue always reflects the latest configuration and whose OnChange callback fires on reload.
- scoped lifetime — A service lifetime in which one instance is shared within a scope, which in ASP.NET Core means one HTTP request, then disposed.
Taught in
- The Options Pattern: Strongly Typed Configuration — Modern .NET Core, C# & Enterprise Microservices