/// <summary> /// 把结果集流转换成数据实体列表 /// </summary> /// <typeparam name="T">数据实体类型</typeparam> /// <param name="reader">结果集流</param> /// <returns>数据实体列表</returns> public static List <T> Select <T>(this IDataReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } return(EntityConverter <T> .Select(reader)); }
/// <summary> /// 把结果集流转换成数据实体列表 /// </summary> /// <typeparam name="T">数据实体类型</typeparam> /// <param name="reader">结果集流</param> /// <returns>数据实体列表</returns> public static List <T> ToList <T>(this IDataReader reader) where T : class, new() { Check.NotNull(reader, "reader参数不能为空"); return(EntityConverter <T> .Select(reader)); }
/// <summary> /// 把结果集流转换成数据实体列表 /// </summary> /// <typeparam name="TEntity">数据实体类型</typeparam> /// <param name="reader">结果集流</param> /// <returns>数据实体列表</returns> public static TEntity ToEntity <TEntity>(this IDataReader reader) where TEntity : class, new() { Check.NotNull(reader, "reader参数不能为空"); return(EntityConverter <TEntity> .Select(reader).FirstOrDefault()); }