public virtual IEnumerable <TEntity> GetWhere(object filters, int pageNumber, int pageSize) { var sql = SqlSelectGenerator.GetSelect(filters, pageSize, pageNumber); using (var connection = DbConnectionFactory.CreateConnection()) { return(connection.Query <TEntity>(sql, filters)); } }
/// <summary> /// /// </summary> /// <param name="filters"></param> /// <returns></returns> public virtual IEnumerable <TEntity> GetWhere(object filters) { var sql = SqlSelectGenerator.GetSelect(filters); using (var connection = DbConnectionFactory.CreateConnection()) { connection.Open(); return(connection.Query <TEntity>(sql, filters)); } }
public virtual async Task <IEnumerable <TEntity> > GetWhereAsync(object filters, int pageNumber, int pageSize) { var sql = SqlSelectGenerator.GetSelect(filters, pageSize, pageNumber); using (var connection = DbConnectionFactory.CreateConnection()) { connection.Open(); return(await connection.QueryAsync <TEntity>(sql, filters)); } }
/// <summary> /// /// </summary> /// <param name="filters"></param> /// <returns></returns> public virtual async Task <TEntity> GetFirstAsync(object filters) { var sql = SqlSelectGenerator.GetSelect(filters); using (var connection = DbConnectionFactory.CreateConnection()) { connection.Open(); Task <IEnumerable <TEntity> > queryTask = connection.QueryAsync <TEntity>(sql, filters); IEnumerable <TEntity> data = await queryTask; return(data.FirstOrDefault()); } }