How to store my configuration in an SQL Server database?

Jul 8, 2010 at 5:19 PM
Hi, I'd like to use Enterprise Library 5.0 in order to store my web.config/app.config in SQL Server database instead of configuration files. I've read some articles about that issue, but haven't found an example of what I'm looking for. Can someone attach a simple example of how it's done? Thanks a lot! Orit. Some related articles:
Jul 9, 2010 at 3:05 AM

The source code for the SqlConfigurationSource used to be included in entlib quickstart.  But entlib 5 no longer have any quickstarts included when installing the source code.  I can't find the sample either from the entlibcontrib mentioned in the documentation.  I do know how to use it in version 4.1, if you're interested, here are the steps:

1. Run the Sql script from the SqlConfiguration Folder
2. Open the Solution SQLConfigurationSource.VSTS. 
3. If you want the sql configuration source to be part of the entlib assemblies in the installation folder, make sure you update the project's entlib references to use those entlib assemblies.  Build the Solution
4. Copy the assembies that was created from \EntLib4Src\Quick Starts\SqlConfiguration\Src\Configuration\Design\bin\Debug
5. Paste it to the bin folder where your version of the EntlibConfig.exe and the referenced entlib assemblies resides in;  
6. Run the EntlibConfig.exe
7. Create new application
8. New -> Configuration Sources
9. In the Configuration Sources node, New -> Sql Configuration Source
10,  Add a connection string that points to the database that was created when you executed the sql script from #1.  you created on first step, then fill the four procedure names that was created in first step too.
11,  Set the connection string property of the sql configuration source to the connection string you've just created.   
12,  Set the stored procedure names as well, refer to the created database.
13.  Add the entlib blocks you want and save.  It will automatically be saved in the database.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.

Jul 11, 2010 at 5:30 AM

Thank you for your detailed answer.
I did all the steps until stage 9, but when I create a new application and right click on the Configuration Sources node, I only see 3 options:

- File Configuration Source.
- Manageable Configuration Source.
- System Configuration Source.

Unfortunately, I still don't have Sql Configuration Source.

Additional help will be appreciated.




Jul 11, 2010 at 12:21 PM

I found the problem - I copied the dll files from  \EntLib41Src\Quick Starts\SqlConfiguration\Src\bin\Debug, while the compiler created the relevant ones in D:\EntLib41Src\Quick Starts\SqlConfiguration\Src\Configuration\Design\bin\Debug.

Once I copied the assemblies from the right path, it worked.

Thanks a lot!!! You really helped me on this issue.