Exemplo n.º 1
0
        public static DbType GetDbType(string connectionStringName)
        {
            var providerName = ContextConnectionFactory.GetProviderName(connectionStringName).Lower();

            var type = DbType.MSSql;

            switch (providerName)
            {
            case "mysql.data.mysqlclient":
                type = DbType.MySql;
                break;

            case "oracle.dataaccess.client":
                type = DbType.Oracle;
                break;

            case "postgresql ole db provider":
                type = DbType.PgSql;
                break;

            case "system.data.sqlclient":
            default:
                type = DbType.MSSql;
                break;
            }

            return(type);
        }
Exemplo n.º 2
0
        public static IDataProvider GetProvider(string connectionStringName)
        {
            var connectionString = ContextConnectionFactory.GetConnectionString(connectionStringName);
            var providerName     = ContextConnectionFactory.GetProviderName(connectionStringName);

            var provider = ProviderFactory.GetProvider(connectionString, providerName);

            return(provider);
        }