Skip to content

Upgrade to version 7.0

tsahi edited this page Feb 25, 2021 · 4 revisions

New Architecture

Enterprise Library Data Access Application Block version 7.0 was restructured compared to version 6.3, in order to improve support for specific databases. The major difference is that while previously it was composed of one NuGet package that supported all databases, in version 7.0 the package was split to one common package, EnterpriseLibrary.Data.NetCore (The same package as in version 6.3), and then a series of dependent packages, one for each database technology. This new structure prevents adding dependencies on packages you never really need, reducing dependency hell and package footprint.

DAAB 7.0 is composed of the following packages:

Package name Supports database Supports platform
EnterpriseLibrary.Data.NetCore Any database not directly supported by other packages, through GenericDatabase .NET Standard 2.0, .NET Core 2.1, .NET Core 3.1, .NET Framework 4.5.2, 4.6, 4.7
EnterpriseLibrary.Data.SqlServer.NetCore SQL Server .NET Standard 2.0, .NET Core 2.1, .NET Core 3.1, .NET Framework 4.5.2, 4.6, 4.7
EnterpriseLibrary.Data.Oracle.NetCore Oracle .NET Standard 2.0, .NET Core 2.1, .NET Core 3.1, .NET Framework 4.5.2, 4.6, 4.7
EnterpriseLibrary.Data.OleDb.NetCore OLE DB providers .NET Standard 2.0, .NET Core 2.1, .NET Core 3.1, .NET Framework 4.5.2, 4.6, 4.7
EnterpriseLibrary.Data.Odbc.NetCore ODBC providers .NET Standard 2.0, .NET Core 2.1, .NET Core 3.1, .NET Framework 4.5.2, 4.6, 4.7
EnterpriseLibrary.Data.SqlCe.NetCore SQL CE embedded db .NET Framework 4.5.2, 4.6, 4.7

Configuration

Previously, DAAB could make an educated guess of the database provider required, based on the providerName attribute of the connection string element in app.config or web.config. Because of the new architecture described above, this is no longer possible, and you would have to add configuration informing DAAB what database provider to use for each data provider.

First, add the following element under the configuration/configSections hierarchy:

<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data" />

Then, add the following configuration under the root configuration element. This example demonstrate several data providers, but you should of course only add the ones you need:

<dataConfiguration defaultDatabase="Service_Dflt">
    <providerMappings>
      <add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase, Microsoft.Practices.EnterpriseLibrary.Data.Oracle, Version=7.0.0.0"
           name="Oracle.ManagedDataAccess.Client"/>
      <add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase, Microsoft.Practices.EnterpriseLibrary.Data.SqlServer, Version=7.0.0.0"
           name="System.Data.SqlClient" />
      <add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.OleDb.OleDbDatabase, Microsoft.Practices.EnterpriseLibrary.Data.OleDb, Version=7.0.0.0"
           name="System.Data.OleDb" />
      <add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Odbc.OdbcDatabase, Microsoft.Practices.EnterpriseLibrary.Data.Odbc, Version=7.0.0.0"
           name="System.Data.Odbc" />
    </providerMappings>
  </dataConfiguration>

The defaultDatabase attribute of the dataConfiguration element specifies the name of the connection string to use if DatabaseProviderFactory.CreateDefault() is used. The name of each add element specifies the ADO.NET data provider the databaseType supports.

Oracle

Just as in previous versions, Oracle database provider requires some extra configuration to configure packages.

First, add this element under the configuration/configSections hierarchy:

<section name="oracleConnectionSettings" type="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.Configuration.OracleConnectionSettings, Microsoft.Practices.EnterpriseLibrary.Data.Oracle" />

Then, add the oracleConnectionSettings section under the root configuration element:

  <oracleConnectionSettings>
    <add name="OracleTest">
      <packages>
        <add name="TESTPACKAGE" prefix="TESTPACKAGETOTRANSLATE" />
      </packages>
    </add>
  </oracleConnectionSettings>

Deprecation

This version removes support for older .NET frameworks, which are no longer supported by Microsoft. The following frameworks are no longer supported directly:

Version End of Support Date
Core 2.0 October 1, 2018
Core 3.0 March 3, 2020
.NET Framework 4.5 January 12, 2016

The frameworks currently supported directly are listed above. Other frameworks are supported by the version closest to them from below. E.g. .NET Framework 4.6.1 is supported by the version for .NET Framework 4.6.

A future version will add direct support for .NET 5 and .NET Framework 4.8.