2012-05-25 32 views
0

实体我使用WCF数据服务,实体框架4.1数据服务 - 找到孩子价值

我有2个表有多对多的关系。 我正在尝试基于子值获取实体。

Table 1 (Suppliers) -> ID (PrimaryKey) ,Name ,isEnabled ,Timestamp 
Table 2 (Categories) -> RGID (PrimaryKey) , Name, etc.... 

我试过写这样的URI。 我的目标是检索与RGID = 3

http://localhost/WCFS/WCFService.svc/Suppliers?$expand=Categories&$filter=RGID eq 3 

类别中的所有供应商和这样

http://localhost/WCFS/WCFService.svc/Suppliers?$expand=Categories&$filter=Categories/RGID eq 3 

没有运气。 第二attampt我得到

The 'RGID ' is not allowed at position 11. Member access or specifying a type identifier on a resource set reference is not allowed. 

那么该怎么办呢???

感谢

+0

你通过SQL命令?你的RGID公式3,你是否坚持到某个地方查询? – mfanto

回答

0

使用导航:通过URL

~/Categories(3)/Suppliers 
+0

太棒了!如何使它仅返回供应商实体的一些字段? Like Name,Timestamp –

+0

使用$ select查询选项。例如〜/ Categories(3)/ Suppliers?$ select = Name,Timestamp –