Ejemplo n.º 1
0
        /// <summary>
        ///  查询多个实体集合
        /// </summary>
        /// <typeparam name="T">返回的实体集合类型</typeparam>
        /// <param name="sql">要执行的查询语句</param>
        /// <param name="parameters">执行SQL查询语句所需要的参数</param>
        /// <param name="commandType">执行的SQL语句的类型</param>
        /// <returns></returns>
        public List <T> QueryForList <T>(string sql, List <DbParameter> parameters, CommandType commandType) where T : new()
        {
            DataTable data = ExecuteDataTable(sql, parameters, commandType);

            return(EntityReader.GetEntities <T>(data));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  查询多个实体集合
        /// </summary>
        /// <typeparam name="T">返回的实体集合类型</typeparam>
        /// <param name="sql">要执行的查询语句</param>
        /// <param name="parameters">执行SQL查询语句所需要的参数</param>
        /// <param name="commandType">执行的SQL语句的类型</param>
        /// <returns></returns>
        public List <T> QueryForList <T>(string sql, params MySqlParameter[] parameters) where T : new()
        {
            DataTable data = ExecuteDataTable(sql, parameters);

            return(EntityReader.GetEntities <T>(data));
        }