How to implement pagedList on DbQuery Entity in Dbcontext without fetching full data in .net core?

独自空忆成欢 提交于 2021-02-11 12:49:06

问题


I have to execute a sql string in .net core so first I added a Dbquery type entity in dbcontext.

        internal DbQuery<TempData> MyDataList{ get; set; }

Then I fetched the data with my sql string as

        var data = context.MyDataList.FromSql(dataqueryString).ToList();

Iam getting the data correct but need to implement PagedList on this without fetching the whole data from database.

I have tried like

        var data = context.MyDataList.FromSql(dataqueryString).ToPagedList(1,10)

But this will fetch whole data from database first then implement pagination. Is there any way to do this in a proper way?

来源:https://stackoverflow.com/questions/66020780/how-to-implement-pagedlist-on-dbquery-entity-in-dbcontext-without-fetching-full

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!