views:

50

answers:

2

I had this question solved: http://stackoverflow.com/questions/3898217/define-dynamic-enum

Which I needed to get some Codes defined in the web.config from a class in App_Code for easy call. Well, the problem now is that I need to use this same Codes inside my business classes (and they won't access Web.config keys..

Accepting any solutions or different approaches

A: 

If all of you services are running on the same machine you can define what you need in the machine config file. If they are on different machine you could use a wcf service for common values.

rerun
A: 

If you are building a non-web app, the code in the previous sample:

ConfigurationManager.AppSettings["servTransfer"])

will read from your .exe.config file just like it reads from the web.config file.

Ray
What if it's a web app?
Vitor Reis
then it will read from web.config - the ConfigurationManager knows where to look in different kinds of apps. I use this also - I have a dll which is used in both web and exe apps - it reads config info from the appropriate config file without having to do anything special
Ray