Hi there,
In the new Entity Framework 4.1, there's a property on the DbContext class to set the DefaultConnectionFactory (type System.Data.Entity.Infrastructure.IDbConnectionFactory).
To our comprehension, it is required to have a specific provider's implementation to build a new instance of DbContext with a connection string.
We would like to know if there's an implementation for this in the latest dotConnect for Oracle (6.10.126 23-Mar-11).
If not, any tips on how we could easily implements this for Oracle's dotConnect?
Thank you
Phil
IDbConnectionFactory implementation dotConnect Oracle?
Try something like this code:
Then just add this line of code before instantiating the context:
Code: Select all
public class OracleConnectionFactory: IDbConnectionFactory {
public DbConnection CreateConnection(string nameOrConnectionString) {
if(!string.IsNullOrEmpty(nameOrConnectionString))
return new Devart.Data.Oracle.OracleConnection(nameOrConnectionString);
else
throw new ArgumentNullException("ConnectionString");
}
}
Code: Select all
System.Data.Entity.Database.DefaultConnectionFactory = new OracleConnectionFactory();