コード例 #1
0
        public BaseDbActionService(ConnectInfo connectInfo)
        {
            this.paramterInfo  = null;
            this.disposedValue = false;

            this.connectInfo = connectInfo;
            this.InitConnection();
        }
コード例 #2
0
 public BaseDbActionService(SqlDataBaseService.ConnectInfo connectInfo)
 {
     this.paramterInfo  = null;
     this.disposedValue = 0;
     base..ctor();
     this.connectInfo = connectInfo;
     this.InitConnection();
     return;
 }
コード例 #3
0
        /// <summary>
        /// 根据数据库类型创建数据库命令执行
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static DbCommand DbCommandFactory(ConnectInfo info)
        {
            DbCommand command = null;

            switch (info.BaseType)
            {
            case DataBaseType.SQL_LITER:
                command = new SQLiteCommand();
                break;

            case DataBaseType.SQL_MY_SQL:
                command = new MySqlCommand();
                break;

            case DataBaseType.SQL_SERVER:
                command = new SqlCommand();
                break;

            case DataBaseType.SQL_ORACLE:
                command = new  OracleCommand();
                break;
            }
            return(command);
        }
コード例 #4
0
        /// <summary>
        /// 数据库连接对象创建
        /// </summary>
        /// <param name="connectinfo"></param>
        /// <returns></returns>
        public static DbConnection ConnectionFactory(ConnectInfo connectinfo)
        {
            DbConnection connection = null;

            switch (connectinfo.BaseType)
            {
            case DataBaseType.SQL_LITER:
                connection = baseDBExecute.CreateSQLConnect <SQLiteConnection>(connectinfo.ConnectString);
                break;

            case DataBaseType.SQL_MY_SQL:
                connection = baseDBExecute.CreateSQLConnect <MySqlConnection>(connectinfo.ConnectString);
                break;

            case DataBaseType.SQL_ORACLE:
                connection = baseDBExecute.CreateSQLConnect <OracleConnection>(connectinfo.ConnectString);
                break;

            default:
                connection = baseDBExecute.CreateSQLConnect <SqlConnection>(connectinfo.ConnectString);
                break;
            }
            return(connection);
        }
コード例 #5
0
 public SQLiterDbAction(SqlDataBaseService.ConnectInfo connectInfo)
 {
     base..ctor(connectInfo);
     return;
 }
コード例 #6
0
 /// <summary>
 /// 获取当前管理中的数据库连接操作对象
 /// </summary>
 /// <param name="connectInfo"></param>
 /// <returns></returns>
 private ConnectInfo GetConnectInfo(ConnectInfo connectInfo)
 {
     return(dictionary[connectInfo.ConnectName]);
 }
コード例 #7
0
 /// <summary>
 /// 判断当前数据库连接管理里是否存在连接
 /// </summary>
 /// <param name="connectInfo"></param>
 /// <returns></returns>
 private bool HasConnect(ConnectInfo connectInfo)
 {
     return(dictionary.ContainsKey(connectInfo.ConnectName));
 }