ConfigDb is an alternative to using XML configuration
files and the Windows Registry for your .NET applications. If you're like
many people who don't like using XML config files for
storing and retrieving application data, then
ConfigDb is for you. Using the Windows
Registry can have its own issues with user permissions.
ConfigDb solves these issues by providing a simple yet
powerful configuration database tool.
So what is it? ConfigDb has two components: A
source code file which you include in your project and
which uses FileDb as the
database file. The other is an Editor tool which
you can use to view/edit ConfigDb files. This is a
free tool you can distribute the Editor with your
applications if you need your users to be able to edit
ConfigDb files.
ConfigDb.cs is a source code file you include in your
project, rather than a compiled DLL. This reduces
the number of DLLs to ship - you only need to ship the
FileDb DLL.
ConfigDb only supports two field types:
String and String array. Even though FileDb
supports other native types (e.g. Int, Bool, DateTime,
etc.), we only need these two types for ConfigDb since
all types can be represented as a String.
You use ConfigDb much like you do the
Windows Registry. That is, its organized by a tree
of Keys which can have Values. To get and set
values, we use ConfigDb.OpenKey, ConfigDb.SetValue and
ConfigDb.GetValue. This makes it super easy to
read and write application data from your ConfigDb
files. No more struggling with issues like "how
can I write a setting to my XML config file?".
What about arrays of values? Its all easy now with
ConfigDb. Here is a code snippet for opening a
ConfigDb file and reading a value.
// open the file
string configFilename = Path.Combine( Application.StartupPath, "app.configdb" );
ConfigDb configDb = new ConfigDb();
configDb.Open( configFilename );
// open the Key
ConfigDbKey key = configDb.OpenKey(
ConfigDbKey.CurrentUser, "Settings", false );
// get the value as a String
string value = configDb.GetValue( key, "CmdTimeout");
// get the same value as an Int
Int iValue = configDb.GetValueAsInt( key, "CmdTimeout");
// set a value
configDb.SetValue( key, "CmdTimeout",
ConfigDbDataType.String, 90 );
// set an array value
configDb.SetValue( key, "StringArray",
ConfigDbDataType.String, new String[] { "s1", "s2",
"s3" } );
You can see how easy it is to use ConfigDb instead of
XML config files.
ConfigDb Editor
We have developed the ConfigDb Editor tool so you can
visualize and edit your ConfigDb files. This as a
FREE tool that you can distribute with your applications
if you need to. FileDb is very much like
RegEdit, the Windows Registry editor which ships with
Windows.

|