How can I make a .NET class library read its own configuration file?

前端 未结 7 842
予麋鹿
予麋鹿 2020-12-13 15:10

I have a .NET class library that provides a set of helper functions that are used by several Web Services. This class library must store a single setting, specifically, a co

7条回答
  •  我在风中等你
    2020-12-13 15:37

    This kind of configuration issue is solved quite nicely using Enterprise Library "Shared Configuration Sources" and "Differential Configurations" (for easily switching between multiple environments, etc.).

    To learn about Advanced Configuration Scenarios, try starting here:

    http://msdn.microsoft.com/en-us/library/ff664552(v=pandp.50).aspx

    And to integrate the Enterprise Library Configuration Tool (GUI) in Visual Studio, try here:

    http://visualstudiogallery.msdn.microsoft.com/029292f0-6e66-424f-8381-3454c8222f9a

    The learning curve may seem a bit overwhelming at first, but it is well worth the effort, especially if you are dealing with complex enterprise ecosystems. The integrated tool actually makes it pretty easy to set up a very sophisticated configuration system, and manage it as your requirements change.

    BTW: Once you get the hang of it, you'll probably end up wanting to use it for a lot more than just your Connection Strings!

提交回复
热议问题