Reputation: 323
I have a requirement for storing configuration information relating to a number of different database interfaces. The application will be developed as a Windows Service and I wish to store and retrieve key configuration information from either a custom xml file or the app.config file. The information to be stored/retrieved conforms roughly to the following:
Interface1:
Source:
Table: source_table
Cols:
column1: source_col1
column2: source_col2
column3: source_col3
column4: source_col4
column5: source_col5
column6: source_col6
etc..
Dest:
Table: dest_table
Cols:
column1: dest_col1
column2: dest_col2
column3: dest_col3
column4: dest_col4
column5: dest_col5
column6: dest_cols6
etc...
Interface2:
Source:
Table: source_table
Cols:
column1: source_col1
column2: source_col2
column3: source_col3
column4: source_col4
column5: source_col5
column6: source_col6
etc..
Dest:
Table: dest_table
Cols:
column1: dest_col1
column2: dest_col2
column3: dest_col3
column4: dest_col4
column5: dest_col5
column6: dest_col6
etc...
My experience with app.config is limited to storing simple key/value pairs, so I am looking for some inspiration as to how best to proceed.
Kind Regards
Paul J.
Upvotes: 0
Views: 133
Reputation: 5312
You can either create a custom XML file or a Custom Configuration Section in your app.config in which you will have to create a public class that inherits from the System.Configuration.ConfigurationSection class. I would go with the custom config section as its more "out of the box".
Basic example: http://haacked.com/archive/2007/03/12/custom-configuration-sections-in-3-easy-steps.aspx/
Upvotes: 1