问题
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