Has anyone heard of...

Topics: Data Access Application Block
Mar 2, 2011 at 2:12 PM

Has anyone out there heard of the following Method; DatabaseFactory.CreateDatabaseProvider?  This dll was build with the Enterprise library 3.5 and now I am trying to upgrade the dll to Framework 3.5 and the enterprise library 5.0 and this command is not there anymore.  Here is my code;

 public static DbDataSource GetDataSource()
{
 if (_dataSource == null)
{

 ArgumentValidation.CheckForNullReference(_connectionString, "_connectionString");
 ArgumentValidation.CheckForNullReference(_provider, "_provider");

 Database db = DatabaseFactory.CreateDatabaseProvider(_connectionString, _provider);

 if (db is Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase)
 {
  _dataSource = new SqlServerDataSource(db);
 }
  else

 {
  string providerName = !string.IsNullOrEmpty(db.ToString()) ? db.ToString() : "UNKNOWN";
  throw ExceptionBuilder.DataProviderNotSupported(providerName);
 }

}
 return _dataSource;
}

I think this code returns a datasource.  So what is the direct replacement to this if any?

Mar 3, 2011 at 5:50 AM

I'm not familiar with the method "DatabaseFactory.CreateDatabaseProvider". Have you considered "DatabaseFactory.CreateDatabase" instead and see if it achieves the same?

Mar 3, 2011 at 6:00 AM

Haven't heard of the said method too. Also, are you really referring to Entlib version 3.5? As far as I know there is no such version :)

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Mar 4, 2011 at 12:17 AM

It's most likely a custom build of Enterprise Library.

 

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com