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
Improve early access to Options during Service-Registration (#9)
* docs: add Build-Time Requirements
* docs: add reguest: Early Access to Options During Service Registration
* feat: extend support for Early Access to Options During Service Registration
* fix: add missing AlsoRegisterDirectType parameter after merge
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,6 +97,38 @@ Or in your `.csproj`:
97
97
98
98
**Note:** The generator emits fallback attributes automatically, so the Annotations package is optional. However, it provides better XML documentation and IntelliSense. If you include it, suppress the expected CS0436 warning: `<NoWarn>$(NoWarn);CS0436</NoWarn>`
99
99
100
+
## ⚙️ Requirements
101
+
102
+
### Build-Time Requirements
103
+
104
+
This package uses **Roslyn 5.0.0 (.NET 10)** for source generation. To build projects that consume this package:
105
+
106
+
**Required:**
107
+
-**.NET 10 SDK** (or later)
108
+
109
+
**Important Notes:**
110
+
- Projects targeting **.NET 9 (or earlier)** CAN successfully build using the .NET 10 SDK
111
+
- This is a **build-time requirement only**, not a runtime requirement
112
+
- Your application can still target and run on .NET 9, .NET 8, or earlier framework versions
113
+
- The SDK version only affects the build process, not the target framework or runtime
# But requires .NET 10 SDK to build (due to Roslyn 5.0.0 source generator dependency)
125
+
dotnet build # Must use .NET 10 SDK
126
+
```
127
+
128
+
**Why .NET 10 SDK?**
129
+
130
+
The source generators in this package leverage Roslyn 5.0.0 APIs which ship with .NET 10. While your consuming applications can target any .NET version (including .NET 9, .NET 8, or .NET Framework), the build toolchain requires .NET 10 SDK for proper source generator execution.
-**🔔 Configuration Change Callbacks**: Auto-generated IHostedService for OnChange notifications with Monitor lifetime - perfect for feature flags and runtime config updates
323
355
-**🔧 Post-Configuration Support**: Normalize or transform values after binding with `PostConfigure` callbacks (e.g., ensure paths have trailing slashes, lowercase URLs)
324
356
-**📛 Named Options**: Multiple configurations of the same options type with different names (e.g., Primary/Secondary email servers)
357
+
-**⚡ Early Access to Options**: Retrieve bound and validated options during service registration without BuildServiceProvider() anti-pattern (via `GetOrAdd*` methods)
325
358
-**🎯 Explicit Section Paths**: Support for nested sections like `"App:Database"` or `"Services:Email"`
326
359
-**📂 Nested Subsection Binding**: Automatic binding of complex properties to configuration subsections (e.g., `StorageOptions.Database.Retry` → `"Storage:Database:Retry"`)
327
360
-**📦 Multiple Options Classes**: Register multiple configuration sections in a single assembly with one method call
0 commit comments