WCF Data Services join query

时间秒杀一切 提交于 2019-12-25 06:57:19

问题


I want to retrieve the results of this query (Northwind Database):

var ent = new Entities();

var query = from c in ent.Customers
    join o in ent.Orders on c.CustomerID equals o.CustomerID
    join od in ent.Order_Details on o.OrderID equals od.OrderID
    join p in ent.Products on od.ProductID equals p.ProductID
    where p.ProductName == "Chai"
    select c;

by using WCF Data Services. I type this (which doesn't work):

http://localhost:29792/WcfDataService1.svc/Customers?$select=CompanyName&$expand=Orders/Order_Details/Products?$filter='Name' eq 'Chai'

How should I type it correctly?


回答1:


Although Join isn't supported, navigation properties/associations are, and you can also use .Expand(). So although you can't get it from .Join, there are multiple ways to get the data you need.



来源:https://stackoverflow.com/questions/9654915/wcf-data-services-join-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!