I am trying to implement custom paging in Ext.js grid, I need to get the total records for my table and the records according to page size. I am using a compiled query for this.
But I want to give just one database hit.
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));
This will only give the records only according to the arguments, I want to return total records and custom no of records from here