コード例 #1
0
        public static StiSqlDataConnector Get(StiConnectionIdent ident, string connectionString)
        {
            switch (ident)
            {
            case StiConnectionIdent.Db2DataSource:
                return(StiDb2Connector.Get(connectionString));

            case StiConnectionIdent.FirebirdDataSource:
                return(StiFirebirdConnector.Get(connectionString));

            case StiConnectionIdent.InformixDataSource:
                return(StiInformixConnector.Get(connectionString));

            case StiConnectionIdent.MsAccessDataSource:
                return(StiMsAccessConnector.Get(connectionString));

            case StiConnectionIdent.MsSqlDataSource:
                return(StiMsSqlConnector.Get(connectionString));

            case StiConnectionIdent.MySqlDataSource:
                return(StiMySqlConnector.Get(connectionString));

            case StiConnectionIdent.OdbcDataSource:
                return(StiOdbcConnector.Get(connectionString));

            case StiConnectionIdent.OleDbDataSource:
                return(StiOleDbConnector.Get(connectionString));

            case StiConnectionIdent.OracleDataSource:
                return(StiOracleConnector.Get(connectionString));

            case StiConnectionIdent.PostgreSqlDataSource:
                return(StiPostgreSqlConnector.Get(connectionString));

            case StiConnectionIdent.SqlCeDataSource:
                return(StiSqlCeConnector.Get(connectionString));

            case StiConnectionIdent.SqLiteDataSource:
                return(StiSqLiteConnector.Get(connectionString));

            case StiConnectionIdent.SybaseDataSource:
                return(StiSybaseConnector.Get(connectionString));

            case StiConnectionIdent.TeradataDataSource:
                return(StiTeradataConnector.Get(connectionString));

            case StiConnectionIdent.VistaDbDataSource:
                return(StiVistaDbConnector.Get(connectionString));

            case StiConnectionIdent.UniversalDevartDataSource:
                return(StiUniversalDevartConnector.Get(connectionString));


            case StiConnectionIdent.ODataDataSource:
                return(StiODataConnector.Get(connectionString));

            default:
                return(null);
            }
        }
コード例 #2
0
        public static StiMySqlConnector Get(string connectionString = null)
        {
            lock (lockObject)
            {
                if (isGeneric == true)
                {
                    return(new StiMySqlConnector(connectionString));
                }
                if (isDevart == true)
                {
                    return(new StiMySqlDevartConnector(connectionString));
                }
                if (connectionString == null)
                {
                    return(new StiMySqlConnector());
                }

                if (isGeneric != true && isDevart != true)
                {
                    isGeneric = null;
                    isDevart  = null;
                }

                if (isGeneric == null)
                {
                    var connector = new StiMySqlConnector(connectionString);
                    isGeneric = connector.AssemblyHelper.IsAllowed;
                    if (isGeneric == true)
                    {
                        return(connector);
                    }
                }

                if (isDevart == null)
                {
                    var connector = new StiMySqlDevartConnector(connectionString);
                    isDevart = connector.AssemblyHelper.IsAllowed;
                    if (isDevart == true)
                    {
                        return(connector);
                    }
                }

                isGeneric = true;
                return(new StiMySqlConnector(connectionString));
            }
        }