Use Enterprise Library in a class library project
Hello,
How do I use the enterprise library in a class library project since it depends on configuration information in the app.config or web.config file (which is not available to a class library)?
Thanks!
jfkrueger,
According to the question on using Enterprise Library in Class Library, I would like to provide you the suggestions as follows:
1. The Enterprise Library application can be added to .NET applications quickly and easily. It also addresses scenarios not directly supported by the underlying class libraries. Different applications have different requirements, and you will not find that every application block is useful in every application that you build. Before using an application block, you should have a good understanding of your application requirements and of the scenarios that the application block is designed to address.
For further information on Enterprise Library 3.1. please take a look at the following article especially the Common Scenarios section:
Patterns & Practices: Enterprise Library
2. The following thread can help you to understand the configuration information in App.Config file on writing some item in the file:
How to write section handler into app.config by code
There is a Configuration Management app block added to .NET Framework version 2.0 to handle this very issue of writing back to the XML application configuration file. It is supposed to be backward compatible or supported to .NET Framework version 1.1. Given this, you want to write the section element definition to the XML application configuration file. I believe that the System.ConfigurationSettings namespace does not support this.
Hope that can help you.