IConfiguration, IOptions or IOptionsSnapshot? Which one?

Published: 15 July 2024
on channel: Round The Code
590
36

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:


.NET tutorials, code examples and coding challenges


► 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 IConfiguration, IOptions or IOptionsSnapshot? Which one? online without registration, duration 08 minute 55 second in high hd 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 590 once and liked it 36 people.