I have a WCF service Operation, I'd like it to return an object graph rather than a simple list of objects. Is there some magic LinQ to do this?
A bit more info is possibly needed:
I have a couple of entities:
StockableItem->Stock is a 1..* relationship.
and I am failing with this linq:
from si in svc.StockableItems.Include("Stock")
join s in svc.Stock on si.Id equals s.Id
where s.Location == 1 select si
and several variations.
I'm hoping the service operation will be able to return something like this:
StockableItem - ID=213, Code=xxx
StockableItem - ID=214, Code=xxx2
+ Stock - ID=214, Location=1, Qty=3
StockableItem - ID=215, Code=xxx3
StockableItem - ID=216, Code=xxx4
+ Stock - ID=216, Location=1, Qty=6
i.e. To return all StockableItems along with the Stock entries for the given location. It's pretty much just a left outer join:
Select * from StockableItems si
Left outer join Stock s ON si.Id = s.Id and s.Location = @Location
but turned into an object graph.