ASP.NET Core & Web API (50 Qs)•Part 3: Distributed Systems, Kestrel Internals & Scalability (25 - 35)
Configuration & Options Pattern: `IOptions` vs `IOptionsSnapshot` vs `IOptionsMonitor`.
senior LevelSystem Design
In Simple Words:
IOptions<T>: Singleton lifetime. Evaluates configuration once on application startup. Does not reflect changes toappsettings.jsonwithout app restart.IOptionsSnapshot<T>: Scoped lifetime. Re-evaluates configuration per HTTP request; reflects live changes inappsettings.json.IOptionsMonitor<T>: Singleton lifetime. Listens for live file changes on disk and notifies viaOnChange()events.