You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Configuration change callbacks**: Auto-generated IHostedService for OnChange notifications with Monitor lifetime - perfect for feature flags and runtime configuration updates
302
302
-**Named options support**: Multiple configurations of the same options type with different names (e.g., Primary/Secondary email servers)
303
+
-**Nested subsection binding**: Automatic binding of complex properties to configuration subsections (e.g., `StorageOptions.Database.Retry` → `"Storage:Database:Retry"`) - supported out-of-the-box by Microsoft's `.Bind()` method
**Description**: Support binding nested configuration sections to complex property types.
464
+
**Description**: Microsoft's `.Bind()` method automatically handles nested configuration subsections. Complex properties are automatically bound to their corresponding configuration subsections without any additional configuration.
463
465
464
466
**User Story**:
465
-
> "As a developer, I want to bind nested configuration sections to nested properties without manually creating separate options classes."
467
+
> "As a developer, I want to bind nested configuration sections to nested properties without manually creating separate options classes or writing additional binding code."
466
468
467
469
**Example**:
468
470
469
471
```csharp
470
472
// appsettings.json
471
473
{
472
474
"Email": {
475
+
"From":"noreply@example.com",
473
476
"Smtp": {
474
477
"Host":"smtp.gmail.com",
475
478
"Port":587,
476
479
"UseSsl":true
477
480
},
478
-
"From":"noreply@example.com",
479
481
"Templates": {
480
482
"Welcome":"welcome.html",
481
483
"ResetPassword":"reset.html"
482
484
}
483
485
}
484
486
}
485
487
488
+
// Options class - nested objects automatically bind!
486
489
[OptionsBinding("Email")]
487
490
publicpartialclassEmailOptions
488
491
{
489
492
publicstringFrom { get; set; } =string.Empty;
490
493
491
-
//Nested object - should automatically bind "Email:Smtp" section
494
+
//Automatically binds to "Email:Smtp" subsection - no special config needed!
492
495
publicSmtpSettingsSmtp { get; set; } =new();
493
496
494
-
//Nested object - should automatically bind "Email:Templates" section
497
+
//Automatically binds to "Email:Templates" subsection
0 commit comments