Exemplo n.º 1
0
        public DBController(ConnectionStringSettings connectionStringSettings)
        {
            this._iDbCommandList = new List <IDbCommand>();
            DatabaseConnectionString connectionString = new DatabaseConnectionString();

            connectionString.ConnectionString = connectionStringSettings.ConnectionString;
            connectionString.ProviderName     = connectionStringSettings.ProviderName;
            this.dbes = new DatabaseExecutiveService();
            this.dbes.SetDatabaseExecutiveServiceConnectionString(connectionString);
            this.dbes.OpenConnection();
            this.connectionString = connectionStringSettings.ConnectionString;
            this.provider         = connectionStringSettings.ProviderName;
        }
Exemplo n.º 2
0
        public void SetDatabaseExecutiveServiceConnectionString(DatabaseConnectionString connectionString)
        {
            this.connString = connectionString;
            this.connString.ConnectionString = connectionString.ConnectionString;
            this.connString.ProviderName     = connectionString.ProviderName;
            switch (this.connString.ProviderName)
            {
            case "System.Data.OracleClient":
                this.conn         = new OracleConnection(this.connString.ConnectionString);
                this.databaseType = DatabaseType.Oracle;
                return;

            case "System.Data.SqlClient":
                this.conn         = new SqlConnection(this.connString.ConnectionString);
                this.databaseType = DatabaseType.SQLServer;
                return;
            }
            throw new Exception(Message.NoSupportDatabaseType);
        }
Exemplo n.º 3
0
        public void SetDatabaseExecutiveServiceConnectionString()
        {
            string str = ConfigurationManager.AppSettings["defaultConnectionString"];
            ConnectionStringSettingsCollection connectionStrings = ConfigurationManager.ConnectionStrings;

            this.connString = new DatabaseConnectionString();
            this.connString.ConnectionString = connectionStrings[str].ConnectionString;
            this.connString.ProviderName     = connectionStrings[str].ProviderName;
            switch (this.connString.ProviderName)
            {
            case "System.Data.OracleClient":
                this.conn         = new OracleConnection(this.connString.ConnectionString);
                this.databaseType = DatabaseType.Oracle;
                return;

            case "System.Data.SqlClient":
                this.conn         = new SqlConnection(this.connString.ConnectionString);
                this.databaseType = DatabaseType.SQLServer;
                return;
            }
            throw new Exception(Message.NoSupportDatabaseType);
        }