Home  /  Questions  /  Question



50   50
Jul 20, 2011


Has anyone created the Oracle DAL for the Design Pattern Framework?

Has anyone been able to get the Oracle DAL completed / working? 
I've tried for days to get Oracle.DataAccess.Client setup to use the pattern for the DAL and sofar have not been successful.

Thanks --
-- Greg D.



275   99.7
Jul 25, 2011
I'm assuming that you're trying to use the SQL example as-is but with Oracle's ODP.NET client.  If so, I have a possible solution (hack) for you that should work.  Unfortunately, I haven't spent a ton of time trying to understand why.

From what I noticed, the "GetFactory" (the one from Systen.Data.Common.DbProviderFactories) method has two overloads... one that takes a string and one that takes a DataRow.  I've seen problems where the string version throws an error (something like "registered provider not loaded" or "provider failed to load" ... make sure it's installed).  The DataRow version does NOT appear to have this problem.

So, the hack is basically to use the "GetFactoryClasses" method to return a DataTable (a bunch of DataRow objects).  Next, find the row where the provder name matches the one you want.  Finally, pass the actual DataRow into the GetFactory() method.

Again, I haven't spent a ton of time looking at this.  I just know that the DataRow version works.  Maybe it has something to do with the complete info being passed in (public token, version, etc.).

Good luck!  =)

Thanx,
Fred

DataTable factories = DbProviderFactories.GetFactoryClasses();
foreach (DataRow row in factories.Rows)
{
  if (row[2].ToString().Equals(_dataProviderName, StringComparison.OrdinalIgnoreCase))
  {
    _factory = DbProviderFactories.GetFactory(row);
    break;
  }
  Debug.WriteLine(row[2].ToString());
}