Enterprise Library 2.0 Configuration Tool - Configuring Data Access Application Block

Enterprise Library 2.0 Configuration Tool - Configuring Data Access Application Block

by David Hayden ( Sarasota .NET Developer )

 

Enterprise Library 2.0 uses pretty extensive use of configuration files for its configuration.  Whether you choose to use the SystemConfigurationSource ( app.config or web.config ) or FileConfigurationSource ( customer configuration files ) you will appreciate the necessary evil of the Enterprise Library 2.0 Configuration Tool for its graphical view and manipulation of the configuration information so you don't have to go spelunking into the configuration file with your favorite text editor.

Once you download and install Enterprise Library 2.0, you will be able to access the configuration tool via the Enterprise Library - January 2006 menu:

 

 

Enterprise Library 2.0 Configuration Tool and Data Access Application Block

When you run the Enterprise Library 2.0 Configuration Tool, you first have to create an application.  Once you create the application, you can right-click on the “Application Configuration” to add configuration sections for the application blocks you will be using in your application.  In this case, I only want to use the Enterprise Library 2.0 Data Access Application Block:

 

 

The configuration tool will create a configuration section for the Data Access Application Block, allowing you to create connection strings and the default database name, provider, and connection string information used by the Data Access Application Block.  In this case, I am creating a connection string for the Northwind Database, assigning it to be the default database with a provider of System.Data.SqlClient.

 

 

The configuration file created by the tool will be similar to the configuration file as mentioned in the following article: Enterprise Library 2.0 - From Configuration Block to IConfigurationSource - SystemConfigurationSource - FileConfigurationSource

 

<configuration>
  <configSections>
    <section name="dataConfiguration"
type="
Microsoft.Practices.EnterpriseLibrary.
Data.Configuration.DatabaseSettings, Microsoft.
Practices.EnterpriseLibrary.Data
" />
configSections> <connectionStrings> <add name="Northwind" providerName="System.Data.SqlClient" connectionString="Data Source=(local);Database=
Northwind;Integrated Security=True
" />
connectionStrings> <dataConfiguration defaultDatabase="Northwind"/> configuration>

 

Conclusion

I have just briefly introduced the Enterprise Library 2.0 Configuration Tool to make sure new users are aware of its existence.  Later I will discuss it in more detail as we take a look at additional application blocks.

 

Source:  David Hayden ( Sarasota .NET Developer )

 

Enterprise Library 2.0 Tutorials and Examples:

 

posted on Monday, January 23, 2006 2:46 PM

Main

News

Green Tea

.NET Development

Enterprise Library

Patterns & Practices