Exemplo n.º 1
0
 public IEnumerable <T> ExecuteIEnumerable <T>(IDbTransaction trans, string commandText, CommandType commandType) where T : class, new()
 {
     using (IDataReader dr = MySqlHelper.ExecuteReader(trans, commandType, commandText))
     {
         return(DataReaderExtensions.DataReaderToList <T>(dr));
     }
 }
Exemplo n.º 2
0
 public IEnumerable <T> ExecuteIEnumerable <T>(IDbConnection conn, string commandText, CommandType commandType, params IDataParameter[] parameterValues) where T : class, new()
 {
     using (IDataReader dr = MySqlHelper.ExecuteReader((MySqlConnection)conn, commandType, commandText, parameterValues))
     {
         return(DataReaderExtensions.DataReaderToList <T>(dr));
     }
 }
Exemplo n.º 3
0
 public IEnumerable <T> ExecuteIEnumerable <T>(IDbConnection conn, string commandText, CommandType commandType) where T : class, new()
 {
     using (IDataReader dr = SQLHelper.ExecuteReader((SqlConnection)conn, commandType, commandText))
     {
         return(DataReaderExtensions.DataReaderToList <T>(dr));
     }
 }
Exemplo n.º 4
0
 public IEnumerable <T> ExecuteIEnumerable <T>(IDbTransaction trans, string commandText, CommandType commandType, params IDataParameter[] parameterValues) where T : class, new()
 {
     using (IDataReader dr = SQLHelper.ExecuteReader(trans, commandType, commandText, parameterValues))
     {
         return(DataReaderExtensions.DataReaderToList <T>(dr));
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 执行SQL语句或者存储过程 ,返回IEnumerable<T>
 /// </summary>
 /// <typeparam name="T">返回类似</typeparam>
 /// <param name="connKey">连接字符串Key</param>
 /// <param name="commandText">SQL语句或者存储过程名</param>
 /// <param name="commandParameters">SQL语句或者存储过程参数</param>
 /// <param name="commandType">SQL语句类型</param>
 /// <param name="commandTimeout">超时时间</param>
 /// <returns>IEnumerable</returns>
 public IEnumerable <T> ExecuteIEnumerable <T>(string connKey, string commandText, List <IDataParameter> commandParameters = null, CommandType commandType = CommandType.Text, int?commandTimeout = null) where T : class, new()
 {
     using (MySqlConnection conn = GetConnByKey(connKey))
     {
         using (IDataReader dr = SQLHelper.ExecuteReader(conn, commandText, commandParameters, commandType, commandTimeout))
         {
             return(DataReaderExtensions.DataReaderToList <T>(dr));
         }
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 执行sql语句,ExecuteReader 返回IDataReader
 /// </summary>
 /// <param name="connectionStringKey">数据库连接字符串的Key</param>
 /// <param name="commandText">sql语句</param>
 public IEnumerable <T> ExecuteIEnumerable <T>(string connKey, string commandText, CommandType commandType) where T : class, new()
 {
     using (MySqlConnection con = GetConnByKey(_ConnectionStringKey))
     {
         using (IDataReader dr = MySqlHelper.ExecuteReader(con, commandType, commandText))
         {
             return(DataReaderExtensions.DataReaderToList <T>(dr));
         }
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// 执行sql语句,ExecuteReader 返回IDataReader
 /// </summary>
 /// <param name="connectionStringKey">数据库连接字符串的Key</param>
 /// <param name="commandText">sql语句</param>
 /// <param name="parameterValues">参数</param>
 public IEnumerable <T> ExecuteIEnumerable <T>(string connKey, string commandText, CommandType commandType, params IDataParameter[] parameterValues) where T : class, new()
 {
     using (SqlConnection con = GetConnByKey(_ConnectionStringKey))
     {
         using (IDataReader dr = SQLHelper.ExecuteReader(con, commandType, commandText, parameterValues))
         {
             return(DataReaderExtensions.DataReaderToList <T>(dr));
         }
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// 执行sql语句,ExecuteReader 返回IDataReader
 /// </summary>
 /// <param name="commandText">sql语句</param>
 /// <param name="parameterValues">参数</param>
 public IEnumerable <T> ExecuteIEnumerable <T>(string commandText, CommandType commandType, params IDataParameter[] parameterValues) where T : class, new()
 {
     if (null != PangXieKX.Plathform.DB.Transactions.Transaction.Current)
     {
         return(ExecuteIEnumerable <T>(Transaction.Current.DbTransactionWrapper.DbTransaction, commandText, commandType, parameterValues));
     }
     else
     {
         using (MySqlConnection con = GetConnByKey(_ConnectionStringKey))
         {
             using (IDataReader dr = MySqlHelper.ExecuteReader(con, commandType, commandText, parameterValues))
             {
                 return(DataReaderExtensions.DataReaderToList <T>(dr));
             }
         }
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// 执行SQL语句或者存储过程 ,返回IEnumerable<T>
        /// </summary>
        /// <typeparam name="T">返回类似</typeparam>
        /// <param name="trans">语句所在的事务</param>
        /// <param name="commandText">SQL语句或者存储过程名</param>
        /// <param name="commandParameters">SQL语句或者存储过程参数</param>
        /// <param name="commandType">SQL语句类型</param>
        /// <param name="commandTimeout">超时时间</param>
        /// <returns>IEnumerable</returns>
        public IEnumerable <T> ExecuteIEnumerable <T>(IDbTransaction trans, string commandText, List <IDataParameter> commandParameters = null, CommandType commandType = CommandType.Text, int?commandTimeout = null) where T : class, new()
        {
            IDataReader dr = SQLHelper.ExecuteReader(trans, commandText, commandParameters, commandType, commandTimeout);

            return(DataReaderExtensions.DataReaderToList <T>(dr));
        }