I like having comments in my configuration files, or be able to easily switch different setups by uncommenting one version of a setting and commenting another version.

In XML based config files, this is easy with XML comments. In NopCommerce, database settings are stored in ~/App_Data/Settings.txt.

 

The file doesn't have a particular format, just one setting per line: key:value. And it is read out as such. The settings reader does however parse the settings by preset keys, so, just putting whatever character in front of the key will make sure that is not read.

 

So simply doing this, gives me what I need:

 

DataProvider: sqlserver

DataConnectionString: Data Source=myserver;Initial Catalog=mydb;Integrated Security=False;Persist Security Info=False;User ID=user;Password=password

#DataConnectionString: Data Source=(local);Initial Catalog=mydb;Integrated Security=True;Persist Security Info=False

Tags: , | Categories: