none
Settings & config files RRS feed

  • Question

  • Hi,
    I've got a solution containing one WCF Service project and several Class Libraries. And for each Library I would like to have a strongly typed Settings Class that would allow server admin to easily (ex. notepad) change settings after deployment. I tried to have different settings files but the configuration is stored in the DLL which is not human-readable. I want to point that keeping everything in web.config isn't an option - I would have to pass lots of parameters to each DLL. If someone had similar problems and want to share the solution I would be thankful Smile
    Sunday, July 27, 2008 12:30 AM

Answers

  • Ok, but since you don't *need* a config file to configure the service it might end up being more practical to just have your own configuration component. Whichever mechanism you use let us know how it turns out, good luck.

    Sunday, July 27, 2008 9:17 PM

All replies

  • One option is to Role your own xml file. A project I worked on used a config file for the WCF components that could be placed in any directory. From memory I believe it created it's own AppDomain so you could provide the exact path, then grabbed the config settings from that domain. You could go that route too. I should say I didn't write that myself so I'm not 100% on how it was eventually done.


    Sunday, July 27, 2008 8:02 AM
  • Thx for reply. But does having my own xml file allow me to use strongly-typed Settings? And another question. This approach requires creating separate AppDomain for every library, right?
    Sunday, July 27, 2008 9:14 AM
  • re: strongly typed - kind of if you use LINQ.
    re: domains, yes if you wanted a separate config for each DLL then yes, but I don't see why you wouldn't have a single XML file with islands per dll.

    Sunday, July 27, 2008 3:43 PM
  • Thanks pkr2000! The reason why I don't want to have a single XML is that, the WCF service 'sees' other layers through interfaces and shouldn't know what parameters to pass. Ex. The storage layer could a be simple file or a database which requires a ConnectionString - from a lower layer configuration file. If there were separate 'app.config-like' config files build based on Settings.settings for every DLL that would be it. For the time being I will try to use the AppDomain method. Thx again!
    Sunday, July 27, 2008 5:10 PM
  • Ok, but since you don't *need* a config file to configure the service it might end up being more practical to just have your own configuration component. Whichever mechanism you use let us know how it turns out, good luck.

    Sunday, July 27, 2008 9:17 PM