Configuration system overhaul

Issue #50 resolved
Paul Glavich
repo owner created an issue

The configuration system is rather unwieldy at the moment and has simply been extended from the very initial, albeit less than stellar design. The intention is remove the older .settings config system with the config section, still allow the appSettings and have that as the main config settings, in addition to reworking how the configuration is specified and overidden in code.

Currently starting a new job so time is pretty poor atm but raising this issue to address at a later point.

Comments (9)

  1. Marko Hrovatic

    There seems to be

    <section>
    

    declaration for applicationSettings section missing for Web.config in the new 4.2.0 Nuget package. I wasn't able to run my app. Since I don't know what changed I reverted back to 4.1.1

  2. Paul Glavich reporter

    Sorry Marko, I don't think I highlighted this enough in the documentation. The 'old' way of configuration was to use a registered section. The use of <appSettings> was introduced some time ago but essentially there was two ways of doing the same thing resulting in code bloat and also unecessary configuration. The way to get around it is to use the equivalent <appSettings> section. For example, where you previously had something like:

    <applicationSettings>
            <Glav.CacheAdapter.MainConfig>
                <setting name="CacheToUse" serializeAs="String">
                    <value>memcached</value>
                </setting>
                <setting name="DistributedCacheServers" serializeAs="String">
                    <value>localhost:11211</value>
                </setting>
            </Glav.CacheAdapter.MainConfig>
    </applicationSettings>
    

    You would now have:

    <appSettings>
      <add key="Cache.CacheToUse" value="memcached" />
      <add key="Cache.DistributedCacheServers" value="localhost:11211" />
    </appSettings>
    

    This cleans up your config file as you dont need a registered section, the config is less verbose and allows me to centralise the type of config so the supporting code is cleaner and easier to extend.

  3. Paul Glavich reporter

    Actually, correction I just realised there was a packaging error with my package automation script that includes an older DLL version within the full Glav.CacheAdapter package. Correcting now and will republish

  4. Paul Glavich reporter

    Ok, so 4.2.1 has the package fix. The old package had a 'lowest dependency' setting with a dependency listed as 4.1.1 instead of 4.2.0. My scripts had an issue in the build which has now been resolved. Anybody using the 'Core' package would be unaffected.

  5. Log in to comment