Giter Site home page Giter Site logo

Comments (2)

sgjsakura avatar sgjsakura commented on May 23, 2024

@sylvaincaillot Hi, thank you for your feed back, this problem may caused by the EntityFramework Core library but not by the pager. Please try to remove the ToPagedList invokation and replace it with Skip and Take, e.g.

var result = (from i in myModel select i).Skip(10).Take(10);

If the problem still occurs, it then can be confirmed this problem is caused by EntityFramework. Please report this issue to the ASP.NET Core development team thought https://github.com/aspnet/EntityFramework/issues .While if the problem does not occur again, please let me know as soon as possible.

Thank you again and waiting for your kind reply :-)

from aspnetcore.

sylvaincaillot avatar sylvaincaillot commented on May 23, 2024

Thnak you @sgjsakura for your quick reply

I followed your advices and got the same error for the following:

IQueryable<SearchResultViewModel> SearchVM = (from item in _context.MyModel
                                                         select new SearchResultViewModel()
                                                         {
                                                             A = item.a,
                                                                B= item.b
                                                         }).Skip(10).Take(10);

            model.SearchResults = SearchVM.ToList();
            return model;

If I remove the .Skip(10).Take(10), it works fine...

Using SQL Server 2008 R2, I needed to add UseRowNumberForPaging in my context as suggested here

 optionsBuilder.UseSqlServer(_config["ConnectionStrings:MyConnection"], b => b.UseRowNumberForPaging());

Cheers

S.

from aspnetcore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.