Upgrading EntLib 4.1 to 5 with Oracle.DataAccess.Client

I am updating the project from EntLib 4.1 to EntLib 5. I have looked at the Migration Guide, changed all the links and updated all the configuration files to point to EntLib 5. Everything worked fine, accepting access to the Oracle database. With configuration file:

<configuration> <configSections> <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" /> </configSections> <dataConfiguration defaultDatabase="prod"> <providerMappings> <add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase, Microsoft.Practices.EnterpriseLibrary.Data" name="Oracle.DataAccess.Client" /> </providerMappings> </dataConfiguration> <connectionStrings> <add name="prod" connectionString="Data Source=dev;User Id=dev;Password=dev;" providerName="Oracle.DataAccess.Client" /> </connectionStrings> </configuration> 

which worked with 4.1, all calls to DatabaseFactory.CreateDatabase() fail with:

 System.InvalidOperationException: The type Database cannot be constructed. You must configure the container to supply this value. 

If I replaced Oracle.DataAccess.Client with Microsoft System.Data.Oracleclient , it all works again, but not full of wonderful ODP.net. Does anyone know how to make this work with EntLib 5?

Cheers, MLK

+4
source share
3 answers

It seems that the Oracle installer sometimes forgets about the factory database provider that is installed in machine.config . To fix this, you need to put it either in app.config or in machine.condig .

 <system.data> <DbProviderFactories> <add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342" /> </DbProviderFactories> </system.data> 

I think this work in EntLib4 is that EntLib4 uses the previous version of the Oracle client (10.2.0.1, I think the Oracle numbering is odd).

+5
source

Use the configuration shown in this link .

or, check out App.config from the sample found at the end of the post with the same link.

+1
source

use ODP.NET 11g for framework 4.

0
source

Source: https://habr.com/ru/post/1308465/


All Articles