DYNAMICALLY Load Settings With IOptions in ASP NET Core
June 14, 2024
• 2,258 views
.net coredotnetasp net coreasp netaspnetaspnetcoreweb developmentasp.net core web apiapp developmentcodecodingnick chapsasmicrosoftmicrosoft mvpc#.netcsharpIOptionsIOptionsMonitorIOptionsMonitor C#appsettings.jsonappsettings.json connection stringappsettings.json .net coreoptions pattern .netioptions .net coresoftware engineeringdot netoptions pattern c#c# options patternoptions patterndependency injectionbackend developer
Stop right there! Stop it! Stop hardcoding your values into your ASP NET Core applications!
Seriously though -- we have a better way. We can leverage our appsettings.json file in combination with IOptions to pull values out of our configuration. This allows us to avoid having to rebuild an entire application to change values.
But what if your app is already running?!
Don't worry -- there's a solution for that. Stay tuned in this video to see how we can go from hard-coded values to IOptions to dynamically loading those same settings on the fly!
