public List <TEntity> ToList <TEntity>(ProcBuilder procBuilder, TEntity entity) where TEntity : class, new() { // 生成SQL 输入、输出参数化 var sqlParam = procBuilder.InitParam(entity); var param = sqlParam.Param?.ToArray(); var value = SqlExtend.ToList <TEntity>(DataBase.GetReader(CommandType.StoredProcedure, sqlParam.Name, param)); procBuilder.SetParamToEntity(entity); return(value); }
public List <TEntity> ToList <TEntity>(ISqlParam sqlParam) where TEntity : class, new() { var param = sqlParam.Param?.ToArray(); return(SqlExtend.ToList <TEntity>(DataBase.GetReader(CommandType.Text, sqlParam.Sql.ToString(), param))); }
/// <summary> /// 返回返回泛型集合 /// </summary> /// <param name="sqlParam">SQL语句与参数</param> public async Task <List <TEntity> > ToListAsync <TEntity>(ISqlParam sqlParam) where TEntity : class, new() { var param = sqlParam.Param?.ToArray(); return(SqlExtend.ToList <TEntity>(await DataBase.GetReaderAsync(CommandType.Text, sqlParam.Sql.ToString(), param))); }