UnityContainer - Having issues Resolving OdpNet.OracleDatabase

Topics: Data Access Application Block
Nov 16, 2011 at 11:16 PM

Hello All fellow code junkies, 

I have downloaded Enterprise Library Contrib - 5.0 (Oct 2011) and installed per instructions 


My web.config has:

<dataConfiguration defaultDatabase="MyOracleDB">   


<add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase, Microsoft.Practices.EnterpriseLibrary.Data" name="Oracle.DataAccess.Client" />   





<add name="Connection String" connectionString="Database=Database;Server=(local)\SQLEXPRESS;Integrated Security=SSPI"      providerName="System.Data.SqlClient" />   

<add name="MyOracleDB" connectionString="data source=MINE;user id=XXXXX;password=XXXXX;"  providerName="Oracle.DataAccess.Client" />



********************** START - HERE IS THE ISSUE I'M HAVING ***********************************

My code specifies a concrete DB (not a generic one)

  Dim Ucontainer = New UnityContainer()       

  Ucontainer.AddNewExtension(Of EnterpriseLibraryCoreExtension)()

  _DB = Ucontainer.Resolve(Of OdpNet.OracleDatabase)("MyOracleDB")


OdpNet.OracleDatabase is from EntLiContrib.Data.OdpNet

And I keep getting the followin error message

Resolution of the dependency failed, type = "EntLibContrib.Data.OdpNet.OracleDatabase", name = "OraAspNetProvider". Exception occurred while: while resolving. Exception is: InvalidOperationException - The type String cannot be constructed. You must configure the container to supply this value. 

********************** END - HERE IS THE ISSUE I'M HAVING ***********************************



-- It works OK when I execute the following to build a generic one (using the Unity service locator)

_DB = EnterpriseLibraryContainer.Current.GetInstance(Of Database)()

-- It work OK when I specify a concrete DB of MS SQL

_DB = Ucontainer.Resolve(Of SqlDatabase)("Connection String")

-- I have ODP.NET Version=


Thank you folks - edo@rdo -

Nov 20, 2011 at 1:20 AM


I think your question would be a better fit at the entlibcontrib forum.

Randy Levy
Enterprise Library support engineer

Nov 20, 2011 at 4:51 AM

Chucks.. . I though I had put this on the Entlibcontrib forum....   my bad

anyways, I did find a way to resolve this

Best Regards.