public void TestConvert() { var result = _list.Convert(t => new EmployeeDto()); Assert.AreEqual(2, result.Count); Assert.AreEqual(1, result.Page); Assert.AreEqual(2, result.PageSize); Assert.AreEqual(3, result.TotalCount); Assert.AreEqual(2, result.PageCount); }
public void TestConvert() { var result = _list.Convert(t => new AggregateRootSample()); Assert.Equal(2, result.Data.Count); Assert.Equal(1, result.Page); Assert.Equal(2, result.PageSize); Assert.Equal(3, result.TotalCount); Assert.Equal(2, result.PageCount); Assert.Equal("Name", result.Order); }
public void TestConvert() { var result = _list.Convert(t => new CustomerInfo()); Assert.AreEqual(2, result.Count); Assert.AreEqual(1, result.Page); Assert.AreEqual(2, result.PageSize); Assert.AreEqual(3, result.TotalCount); Assert.AreEqual(2, result.PageCount); Assert.AreEqual("Name", result.Order); }
//[DisableFiltersAttribute(FiltersEnum.SoftDelete)] //示范:关闭数据过滤器(参数为过滤器名称列表) public PagerList <UserDto> Query(UserQuery query) { //todo:easyui组件的ajax请求异常,暂时无法拦截 //throw new Exception("用户查询异常,easyui ajax操作全局异常测试"); if (string.IsNullOrWhiteSpace(query.Order)) //分页必须先进行排序 { query.Order = "Id desc"; } query.TotalCount = _userRepository.GetAllFilterDataPermissions().Count(); IQueryable <User> users = GetQueryConditions(_userRepository.GetAllFilterDataPermissions(), query) //where查询条件必须放在排序和分页前,不然生成SQL有BUG .OrderByIfOrderNullOrEmpty(query.Order) .Skip(query.GetSkipCount()) .Take(query.PageSize); var result = new PagerList <User>(query); result.AddRange(users.ToList()); return(result.Convert(p => p.ToDto())); }
public PagerList<UserDto> Query(UserQuery query) { //todo:easyui组件的ajax请求异常,暂时无法拦截 //throw new Exception("用户查询异常,easyui ajax操作全局异常测试"); if (string.IsNullOrWhiteSpace(query.Order)) //分页必须先进行排序 query.Order = "Id desc"; query.TotalCount = _userRepository.GetAllFilterDataPermissions().Count(); IQueryable<User> users = GetQueryConditions(_userRepository.GetAllFilterDataPermissions(), query) //where查询条件必须放在排序和分页前,不然生成SQL有BUG .OrderByIfOrderNullOrEmpty(query.Order) .Skip(query.GetSkipCount()) .Take(query.PageSize); var result = new PagerList<User>(query); result.AddRange(users.ToList()); return result.Convert(p => p.ToDto()); }