The method 'Skip' is only supported for sorted input in LINQ to Entities

前端 未结 4 750
执笔经年
执笔经年 2021-02-12 10:07

What could be causing this problem?

public ActionResult Index(int page = 0)
{
    const int pageSize = 3;
    var areas = repo.FindAllAreas();
    var paginatedA         


        
4条回答
  •  孤独总比滥情好
    2021-02-12 10:49

    that is worked (use first IOrderedQueryable):

    http://msdn.microsoft.com/en-us/library/bb738702.aspx

     IOrderedQueryable products = context.Products
            .OrderBy(p => p.ListPrice);
    
    IQueryable allButFirst3Products = products.Skip(3);
    
    Console.WriteLine("All but first 3 products:");
    foreach (Product product in allButFirst3Products)
    {
        Console.WriteLine("Name: {0} \t ID: {1}",
            product.Name,
            product.ProductID);
    }
    

提交回复
热议问题