Phil Parker [mailto:[EMAIL PROTECTED] wrote: > This leads on to my next issue, which is that I'm attempting > to use the application configuration file to store settings > for certain properties on winform controls that I'm writing. > The idea being that my control's properties get serialized as > XML into the application configuration file at design time > and then deserialized from the config file at runtime. > > This would allow me to write external app configurators, to > alter the configuration of my app and also allows backup of > configuration for my application. > > Now, my question here, is that I can see from the .NET > configuration system, how to add configuration section > handlers, but I'm not sure when or how to serialize to the > configuration file within the IDE - the handlers according to > the documentation are intended for read only access. > > What I want to do, is as stated serialize to the app.config > file in XML, instead of using the normal code serialization > for properties. I've looked into dynamic properties but this > only seems to apply to simple types and not complex types, > with aggregate classes etc. > > Any suggestions ? n 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.
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
