❔ Method call based on config file
Based on a value in a config file, I want my program to call one of 3 methods who have different parameters but overall do the same thing. What's the best way to handle this? Overloading the method and adding an additional parameter?
9 Replies
Honestly, probably just a switch or if-else
So I would just rewrite this method for the other config values regularly and call them depending on which value is used?
Based on some value in the config file, you said?
Yes
So
Seems like a good approach I suppose, thanks
And you can use IOptionsMonitor to manage changes in config file during runtime
In case you need that, I was excited when first see this and use in my app https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-7.0
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.