Paging in Entity Framework

前端 未结 6 1242
情书的邮戳
情书的邮戳 2020-12-03 00:56

In Entity Framework, using LINQ to Entities, database paging is usually done in following manner:

int totalRecords = EntityContext.Context.UserSet.Count;
var         


        
6条回答
  •  醉梦人生
    2020-12-03 01:42

    Using Esql and mapping a stored procedure to an entity can solve the problem. SP will return totalRows as output parameter and current page as resultset.

    CREATE PROCEDURE getPagedList(
    @PageNumber int,
    @PageSize int,
    @totalRecordCount int OUTPUT
    AS
    
    //Return paged records
    

    Please advise.

    Thank You.

提交回复
热议问题