The Edmunds example focuses on client-side queries to HTTP services that you do not control.
In this case, it sounds like you'd prefer to have everything happen on the server that you do control ... including any side-trips to a WCF service. That would be my preference too ... although I don't know the details that are necessary to make that judgment.
If I only need the related Person
when I fetch a single Contract
, I think I would have my Web API action method return a Contract
graph composed entirely on the server (including the Person
which I fetched on the server via the WCF Service).
But you may be thinking about the client who needs many Contract
entities - each expanded with related Person
entities - in a single call. Is this what you mean when you ask about putting IQueryable
on the method?
If so, I'd still consider composing these entirely on the server - with side-trips to get the related Person
objects - and then perhaps casting the resulting collection as an IQueryable
so that the client could filter. Ugh. I suspect that IQueryable
isn't wise; IEnumerable
is probably better. You can still pass some filtering values to the Web API method (see EntityQuery.withParameters
).