SQL Configuration Source for Entlib 5.0 (need guidance)

Topics: General discussion
Apr 8, 2011 at 8:10 AM

Hello,

Are there any good resources or video examples of implementing the latest version? I know it's hard to find good documentation for open source...so any help would be greatly appreciated.

 I have read the release notes and the readme files downloaded with the source code.

Thanks

--ed--

Apr 8, 2011 at 8:51 AM

There aren't any documentation for this.  But here are the steps on how you can use it after downloading the source code:

1. Open the SqlConfigurationSource.sln.  If you don't have the Moq assemblies, I suggest you just unload the test project so as to be able to build the solution successfully.

2. Copy the Microsoft.Practices.EnterpriseLibrary.SqlConfigurationSource assembly from project's output folder and paste it in the Enterprise Library bin installation folder (C:\Program Files\Microsoft Enterprise Library 5.0\Bin).

3. Run the CreateConfigDb.cmd file under the Scripts folder.  This will create the EnterpriseLibraryConfiguration database where your configuration will be stored.

4. Edit your configuration file using the Enterprise Library Configuration Tool.

5. Add the Configuration Settings section (if it doesn't exists yet) by clicking on the Blocks menu, and select Add Configuration Settings.

6. Add the Sql Server Configuration Source in the list of Sources. 

7. Set it as the default configuration source by selecting it in the Selected Source property of the Configuration Settings.

Any existing entlib configuration or those which you're going to add later will then get saved to the EnterpriseLibraryConfiguration database.

 

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 8, 2011 at 1:19 PM
Thank you for the quick reply.
--ed--

--
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message..
-----------------------------------------------------------------------------------
Apr 15, 2011 at 5:50 PM

I was able to complete all of the steps listed. I manually added the connection string using the tool, which populated a row in the database. Are there any examples of adding configurations using c#, then calling different built in methods to update the database and check for changes if changes are made from the database?

 

thanks

--ed--

Apr 18, 2011 at 2:28 AM

I haven't seen such a sample.  You can add configurations programmatically though using the Fluent Configuration API.  If your selected source is the Sql Configuration Source, calling the UpdateConfigurationWithReplace method of the ConfigurationSourceBuilder will automatically add the configuration to the sql database. 

As for checking if changes are made from the database, the sql configuration source can be configured to poll the database for changes or not through the Monitor Database Changes property.  If you have a special use case which requires you to do this manually at your code level, you can play around with the PollingSqlConfigurationChangeMonitor class, hook up to the SectionsChanged event.

 

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com