Where should the class library (DLL) be stored?

I am already working on a .net project, but I think this question can be applied to any programming language / structure.

The question is what are some good practices for reading configurations for a class library. I can think of the following options:

  • Reading from the application domain configuration file. For example, in the case of a .net web application, read from web.config
  • Reading from a special user file created for this class lib. How to create an xml file for your lib class and place your configuration there.
  • The caller must pass the configuration necessary for the lib class (via the class constructor). Therefore, in this case, the lib class is not directly read from the configuration file, but instead expects the caller to send the requested information.

Any ideas / preferences?

+5
source share
2 answers

Surprisingly (or unsurprisingly?) It depends.

API, , , . , , , , .

, , , . , , .

, , : log4net.

+3

, , :

. , - .net, web.config

, , (nhibernate, log4net, spring.net .. .. ..). , , :

<log4net configSource="Config\log4net.config.xml" />

, , .

"" , . , nhibernate-, "" ( ).

, .

+2

All Articles