Below I've described a system I'd like to have (implement) for managing
configuration data. As far as I can see it doesn't match very well with
the .NET way (but I may be misunderstanding), except that I'd like to use
XML format. Any comments? Suggestions for change? Suggestions for
implementation?

Regards,
Rune Christensen





I would like a system where a component (assembly/class/etc) gets
configuration data from the component creating it.

The creating component should not need to know the configuration data
requirements of the created component.

The created component does not need to know the context from where it got
its configuration data.

The created component can again be a creating component responsible for
supplying configuration data for its child components.


I.e.
The XML format used for configuration data in .NET seems excellent.


An example- it makes some assumptions about how the configuration system is
to be implemented.

An application config file could look something like this:
<AppSettings>

   <ContactManagement>
      <Authentication type=Auth>
         <DBConnectionString>the connection string</DBConnectionString>
         <CaseSensitive>true</CaseSensitivity>
         <log>true</log>
         <LogSettings>
            <FilePath>whatever</FilePath>
         </LogSettings>
      </Authentication>
   </ContactManagement>

   <InvoiceManagement>
      <InvoiceAuthentication ref="DefaultAuthentication"/>
   </InvoiceManagement>

   <DefaultAuthentication type=Auth>
      <DBConnectionString>the connection string</DBConnectionString>
      <CaseSensitive>true</CaseSensitivity>
   </DefaultAuthentication>

</AppSettings>

<ConfigurationTypes>
   <ConfigurationType name=Auth>
      ...whatever... Data common for all Authentication components.
   </ConfigurationType>
</ConfigurationTypes>

Using the example XML above:
The ContactManagement component knows it will use an Authentication
component but doesn't know neither care what configuration data that
component need - it just sends the Authentication element as the XMLNode.

Likewise with the InvoiceManagement component - it sends the
InvoiceAuthentication element. Uses some alternative syntax: The
configuration data for the Authentication component is fetched from the
referred place.


In addition, I'd like the components to be able to test whether  / get
notified whenever configuration data has been changed :-D

In addition 2: Some kind of type system, ref. ConfigurationTypes above.

In addition 3: An optional "name" attribute. E.g in above example replace
      <Authentication type=Auth>
with
      <Authentication type=Auth name="OnSundays">
Ie: Some dynamic way for creating component to select one of several
alternatives for created component.


Regards,
Rune Christensen

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to