© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
5 replies
riazuezra

❔ Options Pattern for injecting configuration

I have a class library (Infrastructure) which has code that injects services in the service container. I want to inject configuration from my appsettings.json using the options patterns and the scope of the class representing the config section (JwtTokenOptions) is limited to the class library. How can I do this? This is what I have done after reading from microsoft docs and it doesn't seem to work. Thanks.

https://learn.microsoft.com/en-us/dotnet/core/extensions/options#optionsbuilder-api
6dcli15670la1.png
Options pattern - .NET
Learn how to use the options pattern to represent groups of related settings in .NET apps.
Options pattern - .NET
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

[solved] Injecting configuration in (minimal) WebAPI
C#CC# / help
4y ago
options pattern not working
C#CC# / help
3y ago
✅ Using Options pattern in MAUI
C#CC# / help
2y ago
Options pattern in a shared class library
C#CC# / help
2y ago