[Enhancement] Add appsettings support
See original GitHub issueDescription
It would be useful to have a way for apps to build with different settings (ie: the appsettings.json
file pattern already common with Microsoft.Extensions.*).
This is often done like in: https://github.com/dotnet/maui/pull/3872
There’s discussion around removing hosting for .NET 6 MAUI GA: https://github.com/dotnet/maui/issues/4393
In the future we should find a path forward to support this.
One idea is to use a source generator to create the code to inject values from the .json files at build time so that we do not pay a performance price for reading and parsing json files from embedded resources.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:18
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Configuration in ASP.NET Core
Learn how to use the Configuration API to configure AppSettings in an ASP.NET Core app.
Read more >A Better Way to Inject AppSettings in Asp.NET Core
To do this, all you need to do is set it up as a service on your Startup.cs file. Startup.cs has a Configuration...
Read more >ASP.NET Core appsettings.json update in code
The way I address this issue is by adding an "override" property is stored in a memory cache. So for example, my application...
Read more >Keeping Configuration Settings in Memory
Typically, you'll retrieve your settings in your project's Startup class (in the Startup.cs file), specifically in the class's ConfigureServices ...
Read more >Using appsettings.json instead of web.config in .NET Core ...
This is a simple post outlining the steps required to quickly get up and running with configuration files in .NET Core applications.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is possible today via -> https://montemagno.com/dotnet-maui-appsettings-json-configuration/ however some startup performance considerations with this method.
I don’t know if it’s already included, but can you also consider supporting
IOptionsMonitor/IOptionsSnapshot
? I have a scenario where I need to reload settings at runtime, I understand it’s something not many people have to do, but if possible it would be awesome. Is there a way to do this at the moment? The best way i found is:and subscribe with the reload token of
IConfiguration
in the services where i need those options.