Hi

I've written a Windows Service which takes its configuration settings from a database. Because the service is running constantly, I need to be sure that the configuration that's being used is always as up to date as possible and will react to any changes in the back-end database within a short period of time.

My intention is to log any received changes so that at a glance I can review the logs and see when a change was made and what the substance of that change was, but I think I've got myself tangled up somewhere.

The way I've set this up (and I'm happy to hear criticisms on it) is that when the service runs, a stored procedure is executed which retrieves all of the relevant configuration values from the database into a table which is held in memory. The RunningConfiguration object (which currently contains 11 properties of varying types) is then instantiated and the values of the properties set.

At regular intervals (currently every 15 minutes), a copy of the configuration object is instantiated (PreviousConfiguration) and populated from the existing configuration, after which the RunningConfiguration is instantiated and populated again. After that takes place, the corresponding properties in both the RunningConfiguration and PreviousConfiguration objects are compared, and any variances stored in my database for future reference.

This is entirely my lack of knowledge at play here, but I'd like to have a single Configuration object that can be cloned for the Running and Previous configurations. I'd also like to find a way of consuming both configuration sets and comparing them without needing to refer to specific properties by name. So far I can loop through the RunningConfiguration object and get it to give me the name, type and value of the property and I can loop through the PreviousConfiguration object and find the corresponding property name and verify that the type hasn't changed, but I've been singularly unable to write the value of the property from RunningConfiguration into the corresponding property on PreviousConfiguration.

Any help would be gratefully appreciated.