当前位置:网站首页>About EF page turning query database
About EF page turning query database
2022-06-26 00:53:00 【App Hunter】
1./// <summary>
/// Turn the page to search
/// </summary>
/// <typeparam name="Tkey"></typeparam>
/// <param name="pageSize"> The size of each page </param>
/// <param name="pageIndex"> Page </param>
/// <param name="total"> total </param>
/// <param name="whereLambda"> Query criteria </param>
/// <param name="orderbyLambda"> Sorting conditions </param>
/// <param name="isAsc"> In ascending order </param>
/// <returns></returns>
public IQueryable<T> LoadPageItems<Tkey>(int pageSize, int pageIndex, out int total, Expression<Func<T, bool>> whereLambda, Func<T, Tkey> orderbyLambda, bool isAsc)
{
total = Entities.Where(whereLambda).Count();
if (isAsc)
{
var temp = Entities.Where(whereLambda).OrderBy<T, Tkey>(orderbyLambda)
.Skip(pageSize * (pageIndex - 1))
.Take(pageSize);
return temp.AsQueryable();
}
else
{
var temp = Entities.Where(whereLambda).OrderByDescending<T, Tkey>(orderbyLambda)
.Skip(pageSize * (pageIndex - 1))
.Take(pageSize);
return temp.AsQueryable();
}
}
边栏推荐
- Kylin
- 1-10Vmware构建自定义的网络架构
- STL tutorial 5-basic concepts of STL and the use of string and vector
- 制作3D浪漫炫酷相册【附源码】
- "Method not allowed", 405 problem analysis and solution
- DPVS fullnat mode management
- Why is it best to use equals for integer comparisons
- 渗透工具-Burpsuite
- What are the red lines of open source that should not be trodden on?
- “Method Not Allowed“,405问题分析及解决
猜你喜欢

Performance leads the cloud native database market! Intel and Tencent jointly build cloud technology ecology
![Chapter V exercises (124, 678, 15, 19, 22) [microcomputer principles] [exercises]](/img/16/d67f38d32af6904a7d0be9f2e5be70.png)
Chapter V exercises (124, 678, 15, 19, 22) [microcomputer principles] [exercises]

Electronic training.

1-10Vmware构建自定义的网络架构

How to deliver a shelter hospital within 48 hours?

Idea kotlin version upgrade

86. (cesium chapter) cesium overlay surface receiving shadow effect (gltf model)

Unified gateway
![[TSP problem] solving traveling salesman problem based on Hopfield neural network with matlab code](/img/a9/4fbe82fc77712f2e10119aacb99143.png)
[TSP problem] solving traveling salesman problem based on Hopfield neural network with matlab code

C#使用MySql进行操作
随机推荐
JS逆向案例:破解登录密码
mysql
Establish a j-link GDB cross debugging environment for Px4
Explain from a process perspective what happens to the browser after entering a URL?
1-11solutions to common problems of VMware virtual machine
ciscn_2019_en_2
Web学习之TypeScript
DPVS fullnat mode management
How to design the product roadmap?
Machine vision: illuminating "intelligence" and creating a new "vision" world
Typescript for Web Learning
关于HC-12无线射频模块使用
Middle order clue binary tree
C#另外一个new类的方式Ico?以及App.config的使用
继承--圣杯模式
C#线程池控制Semaphore
ADC acquisition noise and comparison between RMS filter and Kalman filter
2021-04-28
学习识别对话式问答中的后续问题
Atlas200dk brush machine