private DbFactory(string name, string connectionString, DbProviderName providerName) { _name = name; _connectionString = connectionString; _providerName = providerName; string providerInvariantName = null; switch (_providerName) { case DbProviderName.SqlClient: _parameterNamePrefix = SqlClientParameterNamePrefix; providerInvariantName = "System.Data.SqlClient"; break; case DbProviderName.OleDb: _parameterNamePrefix = OleDbParameterNamePrefix; providerInvariantName = "System.Data.OleDb"; break; default: throw new NotSupportedException(_providerName.ToString()); } if (providerInvariantName == null) { throw new NotSupportedException(providerName.ToString()); } _providerFactory = DbProviderFactories.GetFactory(providerInvariantName); }
public static void SetDbAccessorDbProviderName(DbAccessor dba, DbProviderName dbProviderName) { EvnValRepository.Instance.AddEvnVal(dba.GetHashCode().ToString(), dbProviderName.ToString()); }