Reading from the Client configuration setting

Topics: General discussion
Dec 9, 2011 at 7:43 AM


I have a scenario as follows:

I have a client application which is .NET 3.5 forms based and I am using Enterprise Application Blocks (EAB)5.0 in it for Validation, Loggers and Exception. I have a requirement that should not make the Client tightly coupled with the EAB. Hence, I created a layer between the Client and EAB and complied it as a library dll.  Some thing like

Client App (Forms based.exe) ----> My Library .dll -----> EAB 5.0

Now, when I run my client applicaiton which makes Validation call to EAB through the libary project, EAB is unable to read the configuration settings available in the Client's configuration file. Whereas, if I place the same settings in the library project, then EAB is picking it.

My question is, how can I redirect EAB to read the configuration settings from the Client application?

Please advice.



Dec 10, 2011 at 12:05 AM
Edited Dec 10, 2011 at 12:56 AM

In your library you could load the configuration using a FileConfigurationSource:

      public void Initialize(string fileName)
           FileConfigurationSource fcs =
               new FileConfigurationSource(fileName));

           var builder = new ConfigurationSourceBuilder();

           EnterpriseLibraryContainer.Current =


      public void Initialize()

You could either initialize on first load of any method (but that would mean you would have to check if the configuration is loaded on every call) or you could mandate that before using your library the Initialize method be called.  I would provide an overload that takes the FileName and one with no parameters where you try to load a default config file.

Randy Levy
Enterprise Library support engineer