当前位置:网站首页>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();
}
}
边栏推荐
- 渗透工具-Burpsuite
- 事物/现象/事情/东西/情况/表象
- [机缘参悟-30]:鬼谷子-内揵篇-同理心,站在对方的立场,拉近与对方的心理距离
- Atlas200dk brush machine
- 11.1.1 overview of Flink_ Flink overview
- Logstash discards log data that does not match the file name exactly
- “Method Not Allowed“,405问题分析及解决
- ciscn_ 2019_ en_ two
- DPVS fullnat mode management
- Learn to identify follow-up questions in dialogue Q & A
猜你喜欢

How to design the product roadmap?

DPVS fullnat mode management

leetcode. 14 --- longest public prefix

Learn to identify follow-up questions in dialogue Q & A

jarvisoj_ level2_ x64

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

The maze of God's perspective in robot vision

mtb13_ Perform extract_ blend_ Super{candidate (primaryalternate) \u unique (nullable filtering \foreign\index\granulati

Analyze the five root causes of product development failure

1-9network configuration in VMWare
随机推荐
[机缘参悟-30]:鬼谷子-内揵篇-同理心,站在对方的立场,拉近与对方的心理距离
Blob
Flex & Bison 开始
下载安装Flume
“Method Not Allowed“,405问题分析及解决
MySQL custom function instance
Drag the mouse to rotate the display around an object
Ssl/tls, symmetric and asymmetric encryption, and tlsv1.3
Binary sort tree
1-9Vmware中网络配置
2021-04-28
Data synchronization
Idea set the template of mapper mapping file
Phoenix index
Ad20 (Altium designer) PCB highlight network
Redis的安装及启动
jarvisoj_ level2_ x64
PHP performance optimization
Post ordered clue binary tree
Permission design = function permission + Data permission