none
Best Practice for Program Configuration Data RRS feed

  • Question

  • My program has a pretty complicated set of configuration data, say 20 classes that need to be persisted (ie stored when changed and reloaded when program starts), where each class has approximately 5 different types of data. 

    The volume of data is small.

    My goal is to keep this program simple to install, so would shy away from forcing an installation of a database in order to use this program.

     

    I am rather novice, and would like some guidance from anyone with more experience. So here is what I considered so far:

     

    1)      FileStream with TextFieldParser

    a.       Allows me to do everything I need, but feels way to primitive.

    2)      XmlSerializer with GetType

    a.       Some of my types that contain Dictionary(Of xxx, xxx) generate run time errors.  Maybe there is a work around, but did not pursue solution since would like some feedback on best direction to follow first

    3)      BinaryFormatter

    a.       Works great, but since it is binary, more difficult to debug and edit.

     

     

    My gut feel is that a database is the approach if there was a way to hide it completely from the end user.

     

    Any other suggestions ?

     

    Monday, July 2, 2007 5:58 PM

Answers

  • I'd gravitate toward using an XmlSerializer and storing the data in the application configuration file.

    Have you seen this page? It describes a straightforward method for serializing dictionaries.
    Monday, July 2, 2007 8:30 PM