Source Schema for the Data Access Application Block

Microsoft Enterprise Library 5.0

DropDown image DropDownHover image Collapse image Expand image CollapseAll image ExpandAll image Copy image CopyHover image

This topic lists the XML elements and attributes used to configure the Data Access Application Block. You can manually edit the XML data, but the Enterprise Library configuration tools greatly simplify this task. If you choose to manually edit the XML, use the schema information contained in this topic.

The configuration file has the following section-handler declaration.

XML Copy Code
<configSections>
  <section name="dataConfiguration"
           type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings,
                 Microsoft.Practices.EnterpriseLibrary.Data" />
  <section name="oracleConnectionSettings" 
           type="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.Configuration.OracleConnectionSettings,
                 Microsoft.Practices.EnterpriseLibrary.Data" />
</configSections>

The section-handler declaration contains the name of the configuration settings sections and the names of the section-handler classes that process configuration data in that section. The name of the first configuration settings section is dataConfiguration. The name of the section-handler class is DatabaseSettings (in the Microsoft.Practices.EnterpriseLibrary.Data.Configuration namespace).

The name of the second configuration settings section is oracleConnectionSettings. The name of the section-handler class is OracleConnectionSettings (in the Microsoft.Practices.EnterpriseLibrary.Data.Oracle.Configuration namespace).

connectionStrings Element

The connectionStrings element lists the database connections that can be used by the application. This element is not required. The following sections describe attributes and child elements for the connectionStrings element.

add Child Element

The add element is a child element of the connectionStrings element. The add element adds a database connection. This element is not required. There can be multiple add elements.

Attributes

The following table lists the attributes for the add element.

Attribute

Description

name

The logical name of the database instance that is accessed by the application. The name must be unique within the section. This attribute is required.

providerName

The name of the provider. By default, provider names are defined in the Machine.config file. The providerName must be a provider name specified in a DBProviderFactory class. This attribute is required.

connectionString

A connection string that is valid for the chosen provider. This attribute is required.

dataConfiguration Element

This element is used only if you need to specify a default database or custom provider mappings.

Attributes

The following table lists the attributes of the dataConfiguration element.

Attribute

Description

defaultDatabase

Name of a connection string instance. This instance is used if the application resolves a Database without providing an instance name.

providerMappings Child Element

This element is a child element of the dataConfiguration element. Specify provider mappings only if you use ADO.NET providers with Database-derived classes other than the GenericDatabase class. SQL Server databases and Oracle databases are configured by default and do not need to be specified in this section. An example of a database that is specified in this section is SQL Server CE.

add Child Element

The add element is a child element of the providerMappings element. The add element adds a database connection. This element is not required. There can be multiple add elements.

Attributes

The following table lists the attributes for the add element.

Attributes

Description

databaseType

The type name of a class that derives from the Database class. This attribute is required.

name

The name of the ADO.NET provider type to use. The name must be specified in a DBProviderFactory class. This attribute is required.

oracleConnectionSettings

This element is required only if you need to specify Oracle database package mappings.

add Child Element

The add element is a child element of the oracleConnectionSettings element. The add element adds an instance of an Oracle connection string. This element is not required. There can be multiple add elements.

Attributes

The following table lists the attributes for the add element.

Attribute

Description

name

The name of the Oracle connection string instance. This attribute is required.

packages Child Element

This element is a child of the add element. It specifies an Oracle package. This element is required.

add Child Element

The add element is a child element of the packages element. The add element adds an Oracle package. This element is not required. There can be multiple add elements.

Attributes

The following table lists the attributes of the add child element.

Attribute

Description

name

The name of the Oracle package. This attribute is required.

prefix

The prefix of the Oracle package. This attribute is required.