Using app.config with a class library

后端 未结 9 1332
忘掉有多难
忘掉有多难 2020-11-27 06:47

Frequently I need to create a .Net class library that requires an app.config for things such as database connection strings. However, these settings must be in the calling a

9条回答
  •  一生所求
    2020-11-27 07:02

    I know it's not what you want to hear, but the entry point's config file is the logical place to put these setttings. If every library required its own config file then it would get tedious to have to edit every single file instead of just one.

    I would have a text file with the default settings included as part of your library (and as part of the project) which can be distributed with the library for the default settings configuration (it can be copied and pasted into the config file).

提交回复
热议问题