How should you get config values from appsettings.json?

Published: 15 July 2024
on channel: Round The Code
1,013
46

When using configuration values in an ASP.NET Core Web API, you can either inject IConfiguration, IOptions, or IOptionsSnapshot into your API controller.

We'll inject each one into a controller, test them using an API endpoint to see what they return, and change the configuration values in appsettings.json to see if the change is updated whilst the application is still running.

► Read the tutorial:
https://www.roundthecode.com/dotnet-t...

🎓 .NET tutorials, code examples and coding challenges 🎓
https://www.roundthecode.com/?utm_sou...

► Chapters
0:00 What we'll look at
0:06 Add appsettings
0:29 IConfiguration
4:48 IOptions
6:21 IOptionsSnapshot
7:29 Nested configuration
8:33 Which one to use?


Watch video How should you get config values from appsettings.json? online without registration, duration hours minute second in high quality. This video was added by user Round The Code 15 July 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,013 once and liked it 46 people.