Exemplo 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> QueryAsObjectInstanceList <T>(string sql) where T : new()
        {
            DbDataReader dataReader = base.ExecuteReader(CommandType.Text, sql);

            return(EntityReader.GetEntities <T>(dataReader));
        }
Exemplo 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> QueryAsObjectInstanceList <T>(CommandType commandType, string sql, params DbParameter[] parameters) where T : new()
        {
            DbDataReader dataReader = base.ExecuteReader(commandType, sql, parameters);

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