Switch-less code : An Example in ASP.NET Core

It is common in ASP.NET Core application to store one or more configuration options in appsettings.json. These options are then read inside MVC controllers or Razor Pages page models. Depending on a particular configuration setting you want to execute certain piece of processing. Although it sounds quite simple and straightforward beginners often end up doing this in a not-so-good way. To that end this article discusses a possible approach that is more flexible and helps you reduce the amount of future changes.

http://www.binaryintellect.net/articles/0d98810d-8b23-4f6c-849b-00a1b4ad47d9.aspx