Wcf数据服务$expand问题
我有 2 个表“内容”和“频道”。具有频道导航属性的内容
我在数据服务中创建了一个方法“GetContentsOfChannel”,该方法将channelID作为para并
通过执行下面的uri返回该channelID的所有内容我正在获取该频道id的所有内容
http://localhost:28553/WNADataService.svc/GetContentsOfChannel?channelID=37
但我也想要每个内容的频道详细信息,当我尝试使用 $expand 时,我收到错误
http://localhost:28553/WNADataService.svc/GetContentsOfChannel?channelID=37$expand=Channels
是我遗漏了一些东西还是有任何其他方式可以获取所有详细信息
请帮助我
i am having 2 tables Content and Channel. content having the navigation property of channel
i have created a method "GetContentsOfChannel" in data service which takes channelID as para and return all the contents of that channelID
by executing below uri i am getting all the contents of that channel id
http://localhost:28553/WNADataService.svc/GetContentsOfChannel?channelID=37
but i also want the channel details for each content when i tried with $expand i am getting error
http://localhost:28553/WNADataService.svc/GetContentsOfChannel?channelID=37$expand=Channels
is i am missing some thing or there is any other way by which i can get all the details
please help me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它应该是
http://localhost:28553/WNADataService.svc/GetContentsOfChannel?channelID=37&$exp and=Channels
&为了向查询字符串添加新参数
$expand - 用于加载相关实体的 OData 参数名称
it should be
http://localhost:28553/WNADataService.svc/GetContentsOfChannel?channelID=37&$expand=Channels
& in order to add new param to query string
$expand - OData param name to load related entity
尝试使用 & 而不是 $
希望这会有所帮助。
Try using & insteadof $
Hope this helps.