【问题标题】:Wcf data service $expand issueWcf 数据服务 $expand 问题
【发布时间】:2012-01-27 20:26:56
【问题描述】:

我有 2 个表格内容和频道。具有频道导航属性的内容

我在数据服务中创建了一个方法“GetContentsOfChannel”,它以channelID为参数并返回该channelID的所有内容

通过在 uri 下面执行,我得到了该频道 ID 的所有内容

http://localhost:28553/WNADataService.svc/GetContentsOfChannel?channelID=37

但是当我尝试使用 $expand 时,我还想要每个内容的频道详细信息,但我遇到了错误

http://localhost:28553/WNADataService.svc/GetContentsOfChannel?channelID=37$expand=频道

是我遗漏了什么还是有其他方法可以获取所有详细信息

请帮帮我

【问题讨论】:

    标签: wcf-data-services


    【解决方案1】:

    应该是http://localhost:28553/WNADataService.svc/GetContentsOfChannel?channelID=37&$exp‌​and=Channels

    & 以将新参数添加到查询字符串 $expand - 加载相关实体的 OData 参数名称

    【讨论】:

      【解决方案2】:

      尝试使用 & 代替 $

      希望这会有所帮助。

      【讨论】:

      • 我想你的意思是在 $expand 前面加上 &。
      • http://localhost:28553/WNADataService.svc/GetContentsOfChannel?channelID=37&expand=Channels