1

とにかく、これはエンティティフレームワークに関連する質問かもしれません。

次の単純なデータベーススキーマについて考えてみます。

CREATE TABLE Supplier(
    SupplierId int identity(1,1) not null primary key,
    DisplayName nvarchar(50)
)

CREATE TABLE Category(
    CategoryId int identity(1,1) not null primary key,
    DisplayName nvarchar(50)
)

CREATE TABLE Product(
    ProductId int identity(1,1) not null primary key,
    SupplierId int references Supplier.SupplierId,
    CategoryId int references Category.CategoryId,
    DisplayName nvarchar(50)
)

私が欲しいのは、サプライヤーとカテゴリーに基づいて製品をフィルタリングすることです。通常は、カテゴリIDとサプライヤIDを指定するだけですが、データベースをEFで公開しているため、DataServicesでは次のようなことはできません。

$filter=SupplierId eq 1 and CategoryId eq 2

これはかなり一般的なシナリオのように思われるので、可能である必要があります。しかし、どのように?

4

1 に答える 1

2

それは非常に簡単であることがわかりました。これがどのように行われるかです:

$filter=Product/Supplier/SupplierID eq 1 and Products/Category/CategoryID eq 1

よろしく。

于 2009-04-22T10:38:13.007 に答える