Hi Drew, thanks for your reply, please see my reply in-line:

On Fri, 7 Mar 2003 11:36:56 -0500, Marsh, Drew <[EMAIL PROTECTED]> wrote:

[snip]
>Ok, first things first. You're right, the configuration model is intended
to
>be read-only. That said, there's nothing preventing you from opening the
>.config file with an XmlDocument and going in and replacing nodes using the
>DOM. However, while that's possible, you're failing to take into
>consideration many variables of multi-user environments, permissions and
>windows application certification requirements. The application .config
file
>should be used to store basically static configuration information that can
>*maybe* be changed by admins or power users. It is not intended to be used
>to save user settings. It sounds to me, like your specific propblem relates
>to user settings. The solution for user settings is to maintain a separate
>file stored in the user's application data directory that is specific to
>them. If you need to maintain settings for all users on a machine, you
write
>to the All Users program data directory.

That describes pretty much the scenario I have - the settings I'm
attempting to store are application specific, not user specific and not
necessarily machine-specific (i.e. these settings are not expected to be
shared between apps).  They relate to hardware the PC is connected to and
which the application is question must communicate with.  It is expected
that only admins/power users would alter these settings after install.

Here's a bit more detail about the scenario I have -

I've written an SDK for handling interfacing with a particular class of
hardware devices.

Applications are then written using this SDK, to control these devices.
What I want to be able to do is serialize the device's connection settings
to an external XML config file.  These settings can be complex and are
therefore currently contained in classes which often contain other classes
and have collections etc..  Because the settings are complex I can't use
dynamic properties.

I want the settings to be stored in an external (i.e. not embedded in the
app as a resource) XML config file, in order to enable two things :-
configuration after install by a secondary configurator application, and to
enable backup/restore of configuration data.

I think I've got a handle on how to do the code serialization and XML
serialization, so that I can appropriately have the IDE insert code to read
the settings for the component's property which refers to these settings.

I am concerned however, that if I attempt to serialize to the app.config
file during code serialization in the IDE that it may conflict with how the
IDE itself writes to the config file for dynamic properties.  For example,
given the lack of documentation, it could end up with my code first writing
to the app.config file, only to have the IDE overwrite the config file,
thereby losing my settings.

So, I was wondering, first, if what I'm attempting to do seems acceptable
to you, given the scenario and if you knew of any documentation on the
IDE's method of config serialization ?

I suppose, I could always write to a secondary XML configuration file.
This would avoid any conflicts with the IDE but it just seems like it would
be more elegant to store in the app.config file.  I also, then have some
other issues to handle -

1. how to have the config file in question automatically copied to the
build directory for the app.
2. how to have configurator applications find the secondary configuration
file for the app to be configured (naming polocies ?)

Thanks
Phil




>
>This has been hashed over several times, so check the archives for details.
>
>HTH,
>Drew
>
>[ .NET MVP | weblog: http://dotnetweblogs.com/dmarsh ]
>
>===================================
>This list is hosted by DevelopMentorŪ  http://www.develop.com
>You may be interested in Guerrilla .NET, 24 March 2003, in London
>http://www.develop.com/courses/gdotnet
>
>View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
You may be interested in Guerrilla .NET, 24 March 2003, in London
http://www.develop.com/courses/gdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to