I don't think that the config file story was completely thought out. What we
have is very good, but the designers need to ask more questions about how it
will be used.
1) config files are not writable: you can use the System.Xml classes to
write to it, but it is a pain, and it takes too long to perform. Also once
you have written to a config file the values will be ready _only_ when a new
application domain is created, which usually means you have to restart the
app. (Contrast this to the registry and INI files).
2) config files are per app, so anyone using the same app will have the same
settings, contrast this to the registry where entries are written to the
HKCU hive. You can use isolated storage to store your own private config
files, but you will have to write your own class to read this data and the
values will not be used automatically for framework classes that need config
data
3) config files are simple text files so you cannot apply an ACL for
individual items. Contrast this to the registry (or SQL Server) where an
entry can have an ACL so that certain accounts are refused access to a value
(and presumably to a feature of the app that uses the value).
4) reading and writing to the registry (and items in a database like SQL
Server) is automatically multi-user. Thus more than one thread can read
different values in the registry at the same time. If you want to write to
the config file you'll have to be careful to make sure that your API does
not lock out other threads reading another section of the file. To make sure
that other threads are not locked out for reads, the config API caches the
values it reads into a in-memory HashTable, one for each appdomain.
I would have preferred a database implementation rather than a XML DOM based
implementation. I see few advantages in editing the config file by hand. I
like the following features of the config file:
1) the values read from machine.config and app.config are combined with the
app settings taking precedence
2) framework code get their configuration when they are initialized, because
of (1) it means that a config file distributed with the app would supply the
settings and machine.config does not have to be touched.
Richard
--
my email
ev******@zicf.b et is encrypted with ROT13 (
www.rot13.org)
"Bob Kirkwood" <ki******@k6mfg .com> wrote in message
news:07******** *************** *****@phx.gbl.. .
I believe the intent in .NET is that we store application
setup information in an XML file now instead of the
Registry or INI files. Is this correct?
Are there any tools, sample apps, or guidelines for how to
do this?