先进的数据库查询

问题描述

我有这个方法

public async Task<ProductReport<ProductPrice>> GetCurrentProductsReport()
{
    var query = (DataServiceQuery<ProductPrice>)(
        from p in this.entities.Products
        where !p.discontinued
        orderby p.ProductName
        select new ProductPrice
        {
            Name = p.ProductName,Price = p.UnitPrice ?? 0,});

    var result = await Task<IEnumerable<ProductPrice>>.Factory.FromAsync(query.BeginExecute(null,null),(ar) =>
    {
        return query.EndExecute(ar);
    });

    return new ProductReport<ProductPrice>(result);
}

方法返回的产品的不完全列表。在列表中的项目数量由项目的数量,服务于一体的请求返回的限制。 我需要把所有的数据。

,我知道我可以使用GetContinuation()方法,但我不能在这种情况下使用它。

也许有人知道如何解决这个问题?

解决方法

我需要获取所有数据。

创建一个存储过程并根据需要提取完整的总数据行/列。