// IOptions<T> — singleton, read once at startup, doesn't changepublic class OrderService(IOptions<DatabaseOptions> options){ private readonly DatabaseOptions _db = options.Value;}
// IOptionsSnapshot<T> — scoped, re-reads per request (for reloadable config)public class OrderService(IOptionsSnapshot<DatabaseOptions> options){ private readonly DatabaseOptions _db = options.Value;}
// IOptionsMonitor<T> — singleton, actively watches for changespublic class BackgroundWorker(IOptionsMonitor<WorkerOptions> options){ public void DoWork() { var current = options.CurrentValue; // Always latest }}