Mid
ASP.NET Core
ASP.NET Core
Using Options pattern (IOptions<T>, IOptionsSnapshot<T>,?
IOptionsMonitor<T>)
- IOptions<T>: Reads settings once at startup.
- IOptionsSnapshot<T>: Gets updated settings per request (for scoped services).
- IOptionsMonitor<T>: Supports change notifications and works in singleton
services.
public MyService(IOptions<MySettings> options) {
var settings = options.Value;
}Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png