EntLib 6 RedirectSections ... How to Redirect to pull connection strings from entlib.config

Topics: Data Access Application Block, Exception Handling Application Block, Logging Application Block
Jul 3, 2013 at 7:01 PM
Our solution has numerous projects all using enterprise library logging & exception handling. All projects use a common entlib.config file for logging and exception handling settings.

Now we'd like to use a database listener to put some log entries into the database.

We currently redirect loggingConfiguration and exceptionHandling. I've added a dataConfiguration redirect also.

However, I can't figure out how to get the various projects to pull connection strings from the entlib.config file. All the components default to their own app.config/web.config to search for the connection string to the database.

For instance, unless the component's connectionStrings section has a valid entry, this exception is thrown:

System.InvalidOperationException: The connection string for the database 'logging' does not exist or does not have a valid provider. ---> System.Configuration.ConfigurationErrorsException: The requested database logging is not defined in configuration.

We only use static loggers and exception handlers.

Is it possible to redirect connectionStrings (not all of them, just the one for the logging database)? Or are their other settings to use in the config files in order to pull data configuration (and the connection string) from entlib.config?
Jul 3, 2013 at 7:07 PM
Ok, to solve this simply added a 'connectionStrings' redirect. And it only redirects for those that are needed by entlib.