Reading complex configuration

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter K

    #1

    Reading complex configuration

    Hi

    I need to be able to supply some relatively complex configuration to an
    application. The application will either run in a web context (with a
    web.config file, or as a application with an app.config).

    The only configuration reading I have used before is AppSettings["name"]
    and I have also used Spring Framework. It is more the type of
    configuration that Spring uses I am looking at now.

    Basically I am looking for some pointers on where to start learning how
    to do this - and/or some example code. I think I have to implement a
    "configurat ion reader" but I am not sure...


    An example of the type of configuration I need to read:


    <configuratio n>

    <configSections >
    <sectionGroup name="alpha">
    <section name="serviceFa ctories" type="??, ??" />
    </sectionGroup>
    </configSections>

    <alpha>
    <serviceFactori es>

    <serviceFacto ry name="wcfSearch ServiceFactory"
    factorytype="Al pha.ServiceFact ory.WcfServiceF actory`1,
    Alpha.Wcf.Servi ceFactory"
    contract="alpha .poc.search.wcf .contract.ISear ch">
    <property name="wcfDefini tion"
    value="SearchSe rvice" />
    </serviceFactory>

    <serviceFacto ry name="localSear chServiceFactor y"
    factorytype="Al pha.ServiceFact ory.SimpleLocal ServiceFactory` 1,
    Alpha.Wcf.Servi ceFactory"
    contract="alpha .poc.search.wcf .contract.ISear ch">
    <property name="serviceTy pe"
    value="alpha.po c.search.wcf.se rvice.Search,
    alpha.poc.searc h.wcf.service" />
    </serviceFactory>

    </serviceFactorie s>
    </alpha>





    Thanks,
    Peter


  • Jon Skeet [C# MVP]

    #2
    Re: Reading complex configuration

    On Dec 14, 10:49 am, Peter K <xdz...@hotmail .comwrote:
    I need to be able to supply some relatively complex configuration to an
    application. The application will either run in a web context (with a
    web.config file, or as a application with an app.config).
    >
    The only configuration reading I have used before is AppSettings["name"]
    and I have also used Spring Framework. It is more the type of
    configuration that Spring uses I am looking at now.
    >
    Basically I am looking for some pointers on where to start learning how
    to do this - and/or some example code. I think I have to implement a
    "configurat ion reader" but I am not sure...
    Why implement a configuration reader when Spring has done it all for
    you? Can you not
    use Spring for some reason?

    Jon

    Comment

    • Peter K

      #3
      Re: Reading complex configuration

      "Jon Skeet [C# MVP]" <skeet@pobox.co mwrote in news:df33733a-94d7-40ec-
      926a-41cd94cf7299@i1 2g2000prf.googl egroups.com:
      On Dec 14, 10:49 am, Peter K <xdz...@hotmail .comwrote:
      >I need to be able to supply some relatively complex configuration to an
      >application. The application will either run in a web context (with a
      >web.config file, or as a application with an app.config).
      >>
      >The only configuration reading I have used before is AppSettings["name"]
      >and I have also used Spring Framework. It is more the type of
      >configuratio n that Spring uses I am looking at now.
      >>
      >Basically I am looking for some pointers on where to start learning how
      >to do this - and/or some example code. I think I have to implement a
      >"configurati on reader" but I am not sure...
      >
      Why implement a configuration reader when Spring has done it all for
      you? Can you not
      use Spring for some reason?
      Unfortunately no !!!

      The customer I am working for at the moment does not like open source.
      Don't ask.

      I have used Spring (both java and .net) very successfully over the course
      of several years, and not stumbled across any significant problems. To tell
      the truth I trust Spring's configuration management (and dependency
      injection) a helluva lot more than my "roll your own" version, but there
      you go...

      But I have found some information regarding ConfigurationSe ction, and I
      think that is the way to go.
      http://msdn2.microsoft.com/en-us/library/2tw134k3.aspx

      /Peter

      Comment

      • Jon Skeet [C# MVP]

        #4
        Re: Reading complex configuration

        On Dec 14, 11:10 am, Peter K <xdz...@hotmail .comwrote:
        Why implement a configuration reader when Spring has done it all for
        you? Can you not
        use Spring for some reason?
        >
        Unfortunately no !!!
        >
        The customer I am working for at the moment does not like open source.
        Don't ask.
        Blech. The world is completely mad. :(
        I have used Spring (both java and .net) very successfully over the course
        of several years, and not stumbled across any significant problems. To tell
        the truth I trust Spring's configuration management (and dependency
        injection) a helluva lot more than my "roll your own" version, but there
        you go...
        :)
        But I have found some information regarding ConfigurationSe ction, and I
        think that is the way to go.http://msdn2.microsoft.com/en-us/library/2tw134k3.aspx
        It's certainly *a* way to go, yes :)

        Jon

        Comment

        Working...