/// <summary> /// 查询条件获取所有 /// </summary> /// <returns></returns> public List <T> GetList(Expression <Func <T, bool> > where) { SelectSqlHelper <T> Select = new SelectSqlHelper <T>(); Select.SetWhere(where); return(connection.Query <T>(Select.GetSql(this)).ToList()); }
/// <summary> /// 获取 /// </summary> /// <returns></returns> public T GetFirst() { SelectSqlHelper <T> Select = new SelectSqlHelper <T>(); Select.SetTop(1); return(connection.Query <T>(Select.GetSql(this)).FirstOrDefault()); }
/// <summary> /// 查询条件获取所有 /// </summary> /// <returns></returns> public List <T> GetList(Expression <Func <T, bool> > where, Expression <Func <T, object> > OrderBy, bool IsDesc = true) { SelectSqlHelper <T> Select = new SelectSqlHelper <T>(); Select.SetWhere(where); Select.SetSorting(OrderBy, IsDesc); return(connection.Query <T>(Select.GetSql(this)).ToList()); }
/// <summary> /// 查询条件获取第一个 /// </summary> /// <param name="where"></param> /// <returns></returns> public T GetFirst(Expression <Func <T, bool> > where) { SelectSqlHelper <T> Select = new SelectSqlHelper <T>(); Select.SetTop(1); Select.SetWhere(where); return(connection.Query <T>(Select.GetSql(this)).FirstOrDefault()); }
/// <summary> /// 获取所有 /// </summary> /// <returns></returns> public List <T> GetList() { SelectSqlHelper <T> Select = new SelectSqlHelper <T>(); return(connection.Query <T>(Select.GetSql(this)).ToList()); }