public IConnectionConfiguration GetConnectionConfiguration(string fileName) { // Get the default provider name string providerName = Database.GetDefaultProviderName(); Debug.Assert(!String.IsNullOrEmpty(providerName), "Provider name should not be null or empty"); string connectionString = GetConnectionString(fileName); return(new ConnectionConfiguration(providerName, connectionString)); }
public DbConnection CreateConnection(string connectionString) { if (String.IsNullOrEmpty(_providerName)) { // If the provider name is null or empty then use the default _providerName = Database.GetDefaultProviderName(); } if (_providerFactory == null) { _providerFactory = DbProviderFactories.GetFactory(_providerName); } DbConnection connection = _providerFactory.CreateConnection(); connection.ConnectionString = connectionString; return(connection); }