我正在尝试在 Ext.js 网格中实现自定义分页,我需要根据页面大小获取表的总记录和记录。我正在为此使用编译查询。
但我只想给一个数据库命中。
List<MyTable> .GetRecordsById(Int32 ID, Int32 start, Int32 limit)
{
return CompliedGetRecordsById_CustomPaging(_dbNavigation, ID, start, limit).ToList();
}
/// <summary>
/// Complied query for retrieving manage tasks Custom Paging
/// </summary>
public static readonly Func<SomeEntities, Int32,Int32, Int32, IQueryable<MyTable>> CompliedGetTaskByProjectId_CustomPaging =
CompiledQuery.Compile<SomeEntities, Int32, Int32, Int32, IQueryable<MyTable>>((dbNavigation, ID, start, limit) =>
dbNavigation.SiteTasksMappings.Include("TaskMaster")
.Where(x=> x.myTableID == ID && x.STMIsActive == 1).OrderBy(x=>x.STMID).Skip(start).Take(limit));
这只会根据参数给出记录,我想从这里返回总记录和自定义记录数