views:

83

answers:

1

What is recommended for sharing configuration data amongst several related applications in a winforms solution? The two possible solutions I envisage are using a custom section in the machine.config (?) file, and the other is to create an extra config service application that maintains settings via its Properties class, and handles get and set requests for these settings from all the other applications.

+2  A: 

One issue with the config service app is that you then potentially need to authenticate/authorize callers of the service if the settings contain sensitive data (such as database passwords). May or may not be an issue depending on your environment.

Similarly you could use some other shared resource to store the settings (a shared XML file, a database), but of course you need to "bootstrap" in some way, i.e. each application will have to have information to locate the shared resource (URL of the configuration service, location of an XML file, connection string for the config database).

Another point is that a config service is potentially introducing an additional single point of failure for all dependent apps. Or you can have redundant config services, and then you're back to the issue of synchronisation - complexity that's often not justified just to save the effort of updating multiple config files.

Personally I usually live with independent config files in each app. In some cases providing tools to admins to automate updates to multiple config files (e.g. to change database passwords that are shared across multiple apps).

Joe
Interesting point about the authentication. I've spent a lot of time thinking about how to authenticate one app to another.
ProfK
Authentication between apps the the .NET world is relatively easy. You can run each app under an app-specific identity, and authenticate to the common service using Windows Authentication. Authorization is more work: you may want to protect config of a sensitive app from access by other apps.
Joe
Could you please give me a pointer on where to read about actually doing that?
ProfK
Actually doing authentication? It depends how you're communicating. E.g. if you call a WCF web service from your app, you'd configure both client and server endpoints to use Windows authentication, and your app would run under an identity known to the service. To do this just look at WCF docs.
Joe
I know very little about this, but I was thinking along the pre-WPF lines of client applications impersonating a user created for them, and only that user having access to either a GAC library or Windows Service that serves the config information. That said, I'd love to look into WCF.
ProfK