public BaseDbActionService(ConnectInfo connectInfo) { this.paramterInfo = null; this.disposedValue = false; this.connectInfo = connectInfo; this.InitConnection(); }
public BaseDbActionService(SqlDataBaseService.ConnectInfo connectInfo) { this.paramterInfo = null; this.disposedValue = 0; base..ctor(); this.connectInfo = connectInfo; this.InitConnection(); return; }
/// <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); }
/// <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); }
public SQLiterDbAction(SqlDataBaseService.ConnectInfo connectInfo) { base..ctor(connectInfo); return; }
/// <summary> /// 获取当前管理中的数据库连接操作对象 /// </summary> /// <param name="connectInfo"></param> /// <returns></returns> private ConnectInfo GetConnectInfo(ConnectInfo connectInfo) { return(dictionary[connectInfo.ConnectName]); }
/// <summary> /// 判断当前数据库连接管理里是否存在连接 /// </summary> /// <param name="connectInfo"></param> /// <returns></returns> private bool HasConnect(ConnectInfo connectInfo) { return(dictionary.ContainsKey(connectInfo.ConnectName)); }