Use of "dbProvider" application setting in new ConnectionManager.csUse of "dbProvider" application setting in new ConnectionManager.cs
Old forum URL: forums.lhotka.net/forums/t/5878.aspx
JoshL posted on Tuesday, November 25, 2008
In the new version of ConnectionManager.cs, the database provider for new connections is defaulted to "System.Data.SqlClient" if not provided by a "dbProvider" application setting. Could you use the provider name from the connection string instead? It can be accessed like this:
ConfigurationManager.ConnectionStrings[database].ProviderName
Thanks!
- JoshRegent replied on Thursday, October 01, 2009
I've created a workaround class for that in my project:
public static class ConnectionManager
{
public static Csla.Data.ConnectionManager GetManager(string dataBaseName)
{
ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings[dataBaseName];
ConfigurationManager.AppSettings["dbProvider"] = connectionStringSettings.ProviderName;
return Csla.Data.ConnectionManager.GetManager(connectionStringSettings.ConnectionString, false);
}
}
Copyright (c) Marimer LLC