I have a Solution with 3 projects in, each project needs access to certain settings. I’m looking for a way to have these setting values available to any project from 1 distinct source. I cant use the .Config file as that is relevent to that particular project.
I could use the database but have been told this is not good practice (Without an reason)
Any ideas?
You could do this:
solution.configin your solution folderin each project’s
app.config, add this to your<appSettings>node:You would have to put symbolic links to your common
solution.configin each project folder – but you could have one single physical file that you share amongst the projects.The
<appSettings>node is the only one that allows that sort of “cummulative” settings – those from the file specified in thefile=will be added to your app settings, but potentially overwritten by anything you specify explicitly in yourapp.config.On the other hand, yes, of course, you could use the database. We do that, too, in most of our projects, since we typically do have access to the database, but not to the file system in the client’s server machines. I don’t see why that should necessarily be a bad thing – we have settings for DEV, TEST and PROD in a table – so you have all your settings in one place – and we pick those settings we need when we need them. Works just fine – of course, some settings like the connection strings to the database cannot be stored there – but the bulk of our config info is. Again: I really don’t see any reason why this should be a bad choice per se – so unless your source can back his/her statement up with some facts and reasons, I’d ignore it.