DEV Community

Discussion on: Application Configuration - thinking of configuration as data

Collapse
 
peledzohar profile image
Zohar Peled

In the dot net framework world I used to use App.Settings - edit in VS and have it auto-generate the settings class.
I kinda miss that in the dot net core world, where you have to write both the Json configuration and the cs class to go along with it (I know, you can auto-generate the Json from the cs and vice-versa, but still...)

Collapse
 
zakwillis profile image
zakwillis

Hi Zohar. Thanks for reading.
I see where you are coming from with this. But you don't get the richness of direct object mapping as you get from using key value pairs. Kind of what I see as a big win in .Net Core.

The article was more to do with thinking in terms of config as data and embracing this.

My main issue with App.Config is that to make a professional strongly typed approach involves a lot of overhead. Not only that, the xml inside the app.config file is largely unusable as it is complex xml (as opposed to nested). Using JSON does allow you quite quickly see what is going on with the object.

There is a lot about app.config to like too.

BTW - pretty sure you can still use app.config in .Net Core if you use System.Configuration? This might be one way of upgrading apps. Haven't looked into it.

Collapse
 
peledzohar profile image
Zohar Peled

I'm just ranting, I like the json configuration better than the XML because you don't have to use all the built in crap and simply keep only the things you actually want in the json itself. I totally agree that configuration is data and should be treated as such.