Common class libraries should not read configuration files.... this makes
them too dependant on the outside world. If the class needs something like a
database connection string it should always be sent into it via a property or
better yet the constructor.
David
======================================
David McCarter [Microsoft MVP]
www.dotNetTips.com
David McCarter''''s .NET Coding Standards available at:
http://www.cafepress.com/geekmusicart.1654787045
"rgliane" wrote:
> I have a method in a common class library that reads the application config
> file. If the library is used by a Windows app, it should use
> ConfigurationManager to read the app.config file. If the library is used by
> a Web app, it should use WebConfigurationManager to read the web.config file.
>
>
> Is there a programmatic way to determine what kind of app is running? Or is
> there another approach to handle this kind of thing?
>