Problems with OraDirect and DbProviderFactories.GetFactory

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Sun 20 Aug 2006 18:16

Try to call the next code. It is used by DbProviderFactories.GetFactory.

Code: Select all

  Type type1 = Type.GetType("CoreLab.Oracle.OracleProviderFactory, CoreLab.Oracle, Version=3.50.11.0, Culture=neutral, PublicKeyToken=09af7300eec23701");
  if (type1 == null) {
    throw ADP.ConfigProviderNotInstalled();
  }
  FieldInfo info1 = type1.GetField("Instance", BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly);
  if ((info1 != null) && info1.FieldType.IsSubclassOf(typeof(DbProviderFactory))) {
    object obj1 = info1.GetValue(null);
    if (obj1 != null) {
      return true;
    }
  }
  throw new Exception("The requested .Net Framework Data Provider's implementation does not have an Instance field of a System.Data.Common.DbProviderFactory derived type." );

Post Reply