Hello Nathan,
On Monday, 13 May 2013 19:53:09 UTC-4, Nathan Palmer wrote:
I haven't used the Devart objects before. But to get the text you need for the configuration try to put a line like this at the beginning of your program. Then pull the result out and put it in the text file.
var fullName = typeof(OracleConnection).AssemblyQualifiedName;
Okay, great. It looks like this works!
As for the DbConnectionFactory.... maybe? Is that useful to you? It sounds like you have something working. Do you want to share what that looks like?
In scanning the list, at least two others have had the same error I did.
Here it is. This change is completely generic and could make for less headaches for people like me who are not as familiar with
ADO.NET. I tried to make the message in the exception very explicit as to how the connection was attempted. The logic is almost straight off the API page:
/// <summary>
/// Creates an open connection for a given connection string setting using the provider
/// name to select the proper implementation first using Type.GetType() and if that fails,
/// the DbProviderFactories are attempted.
/// </summary>
/// <param name="connectionString">ConnectionStringSetting node</param>
/// <returns>The open connection</returns>
public static IDbConnection Connection(ConnectionStringSettings connectionString)
{
if (connectionString == null)
throw new InvalidOperationException("Null ConnectionStringSettings specified");
// Original logic
//Type type = Type.GetType(connectionString.ProviderName);
//if (type == null)
// throw new InvalidOperationException("The type name '" + connectionString.ProviderName +
// "' could not be found for connection string: " + connectionString.Name);
//IDbConnection connection = (IDbConnection)Activator.CreateInstance(type);
IDbConnection connection = null;
try
{
Type type = Type.GetType(connectionString.ProviderName);
if (type != null)
{
connection = (IDbConnection)Activator.CreateInstance(type);
}
else
{
DbProviderFactory factory = DbProviderFactories.GetFactory(connectionString.ProviderName);
connection = factory.CreateConnection();
}
}
catch (System.ArgumentException ae)
{
throw new InvalidOperationException("For providerName '" + connectionString.ProviderName +
"', 1) Lookup via Type.GetType() failed and, 2) Lookup via DbConnectionFactory failed " +
"in connection string: " + connectionString.Name + "; message: " + ae.InnerException.Message);
}
connection.ConnectionString = connectionString.ConnectionString;
connection.Open();
return connection;
}
When viewing the DbConnectionFactories on my machine.config, there was an entry for SqlServer and entries for Devart Oracle and Oracle
ODP.NET because I installed the latter two drivers. So in any of these cases, specifying a strong name for the providerName connection information would not be necessary.
Hope this is useful,
-Bill