Hello, I use EntLib 2.0, an by policy of the company I work, all applications must obtain certain information such as configuration connection string, SMTP server mail etc, from a specific configuration files, which can only read the entries for our application
using a class created specifically for this task.
The problem is that some configuration data, such as connection-string for the various blocks should be loaded into the execution mode.
As I can not find how to do one of the problems we encounter is if for example I have a "Database Trace Listener" where there is an attribute "DatabaseInstance" where I choose one of the database instance, but could not specify the connection
string directly in the web.config or mode of execution can not select this instance.
Something similar happens if I have an "Email Trace Listener", where do I get SMTP Server attribute of another application.
Is there any way to change values in run-time mode, or some configuration parameters you can specify that the value of a given parameter will be loaded by a method of a class?
Hope has understood the problem and sorry for my English.
Thank you very much
In the case of your Email Trace Listener, you can change the values of the properties of that listener. like this:
ExeConfigurationFileMap exeFileMap =
exeFileMap.ExeConfigFilename = "Filenameoftheconfig";
Configuration configuration =
LoggingSettings loggingSettings = (LoggingSettings)configuration.Sections.Get(LoggingSettings.SectionName);
EmailTraceListenerData emailData = (EmailTraceListenerData)loggingSettings.TraceListeners.Get("Email TraceListener");
I'm not that sure if the same could be apply and will work in the database tracelistener, perhaps you could try that. Also, there is an option for you to use the Logging Application Block within your application without using configuration files. Please see
Global Technology and Solutions
Please see my EntLibWrapper class at the following link:
I think this will help you.