0

私のデモでは、データベースに TProduct、TCategory、TProductCategoryMap の 3 つのテーブルがあります。

TProduct (ProductId int PK、OtherFields)
TCategory (CategoryId int PK、OtherFields)
TMap (ProductId int PK、CategoryId int PK)

ここで、特定のカテゴリ ID を持つ製品の PagedList を取得する必要があります。

これが私のコードです:

  IQueryable<Product> products = from product in _repo.All<TProduct>()
                                 join map in _repo.All<TMap>() on product.ProductId equals map.ProductId
                                 where map.CategoryId == specificCagetoryId
                                 select product;

ここで製品を返品すれば、すべて問題ありません。しかし、次のような pagedlist を返すと:

   return new PagedList<TProduct>(products, pageIndex, pageSize);

生成された SQL テキストにより、「ランキング関数 "ROW_NUMBER" には ORDER BY 句が必要です。」という構文エラーが発生します。

間違った linq 式を使用していませんか? では、正しい結果を得るにはどうすればよいでしょうか。

アドバイスをください、ありがとう。

4

2 に答える 2

1

これは現在のバージョンのバグです:http://github.com/subsonic/SubSonic-3.0/issuesearch?state = open&q = PagedList#issue / 35

于 2009-07-15T14:51:02.817 に答える
1

このバグを修正しました...今すぐ!今日中に次のリリースをプッシュします。

于 2009-07-15T19:45:13.793 に答える